„The Movie Database“ palaikymas

Hi everyone, i 've been trying to figure how to use the api here. my code is in below. looking for help for how to implement the api to my code. don't know how to implement it to my const url.

import axios from 'axios';

const API_KEY = 'my key';
const ROOT_URL =  `https://api.themoviedb.org/3/movie?api_key=${API_KEY}`

export const FETCH_MOVIES = 'FETCH_MOVIES';

export function fetchMovies(movie){
  const url = `${ROOT_URL}&query={movie}`; //this part i can't figure out what should i type?
  const request = axios.get(url);
}

return{
  type:FETCH_MOVIES,
  payload:request
  }
}

5 atsakė (on page 1 iš 1)

Jump to last post

I'm not a programmer. I can not help with the language.
But I can help with the built URL.
And I see that the movie ID is missing.
For example, the movie ID 550, Fight Club (1999)
https://api.themoviedb.org/3/movie/550?api_key=${API_KEY}

Or this, when looking for the movie title
https://api.themoviedb.org/3/search/movie?api_key=[MY_KEY]&query=Jack%20Reacher
Your ROOT_URL
https://api.themoviedb.org/3/movie?api_key=${API_KEY}
It is different. Needs /search before /movie.

As per @ticao2's comment, your search URL should be:

https://api.themoviedb.org/3/search/movie?api_key=###&query=Jack%20Reacher

I'll only add that if you continue to have issues specific to the language/library you're using, I usually recommend heading over to Stack Overflow. Unless someone with Axios(?) and JavaScript experience happens to pass over this thread you probably won't get much help specific to that.

Please take advantage of api key

@wadie02 I'm not entirely sure what you're asking but If you have a question, please create a new thread and refrain from bumping other people's discussions off topic. Thank you.

Negalite rasti filmo ar TV laidos? Prisijunkite, kad sukurtumėte.

Bendras

s susitelkti į paieškos juostą
p profilio meniu
esc uždarykite atidarytą langą
? spartieji klavišai

Medijų puslapiuose

b grįžkite atgal (arba tėvams leidus)
e į redagavimo puslapį

TV sezono puslapiuose

(dešinė rodyklė) sekantis sezonas
(kairė rodyklė) ankstesnis sezonas

TV epizodo puslapiuose

(dešinė rodyklė) sekantis epizodas
(kairė rodyklė) ankstesnis epizodas

Visuose atvaizdžio puslapiuose

a atverti atvaizdžio pridėjimo langą

Visuose redagavimo puslapiuose

t vertimo parinktys
ctrl+ s pateikti formą

Diskusijų puslapiuose

n sukurti naują diskusiją
w perjungti peržiūros būseną
p perjungti viešasis / privatus
c perjungti uždaryti / atidaryti
a peržiūrėti aktyvumą
r atsakyti į pokalbį
l į paskutinį atsakymą
ctrl+ enter pateikti pranešimą
(dešinė rodyklė) sekantis puslapis
(kairė rodyklė) ankstesnis puslapis

Nustatymai

Norite įvertinti ar įtraukti šį elementą į sąrašą?

Prisijungti