Wsparcie The Movie Database

const GetHeaderWallpaper = async()=>{ try{ const {data} = await axios.get(/trending/all/day); let randomdata = data.results[(Math.random()*data.results.length).toFixed()]; setwallpaper(randomdata); console.log({randomdata}); } catch(error){ console.log("Error:",error); } };

2 odpowiedzi (strona 1 z 1)

Jump to last post

@Samyak.22 said:
after calling api empty array is getting in return
const GetHeaderWallpaper = async()=>{
try{
const {data} = await axios.get(/trending/all/day);
let randomdata = data.results[(Math.random()*data.results.length).toFixed()];
setwallpaper(randomdata);
console.log({randomdata});
}
catch(error){
console.log("Error:",error);
}
};

This code of yours builds an API Request.
Using the AXIOS tool.
What we need to know is which API Request is sent to our server.
Can you tell us what it is here?

Problems with API Request

In order for someone to help you with API Request questions,
it is critical that you post here the API Request you are sending to the TMDb server.
Remember to replace your Key with MY_KEY , YOUR_KEY , THE_KEY , or something like that.

Not the programming code/script you used to build the API Request.
But the API Request that is sent to the TMDb server.
Or the API Request you would like to send.

Nie możesz znaleźć filmu lub serialu? Zaloguj się, aby go utworzyć.

Globalny

s zaznacz pasek wyszukiwania
p otwórz menu profilu
esc Zamknij otwarte okno
? otwórz okno skrótów klawiszowych

On media pages

b go back (or to parent when applicable)
e przejdź do strony edycji

On TV season pages

(prawa strzałka) przejdź do następnego sezonu
(lewa strzałka) przejdź do poprzedniego sezonu

On TV episode pages

(prawa strzałka) przejdź do następnego odcinka
(lewa strzałka) przejdź do poprzedniego odcinka

On all image pages

a otwórz okno dodawania obrazu

On all edit pages

t open translation selector
ctrl+ s prześlij formularz

On discussion pages

n otwórz nową dyskusję
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r odpowiedz na dyskusję
l przejdź do ostatniej odpowiedzi
ctrl+ enter wyślij swoją wiadomość
(prawa strzałka) następna strona
(lewa strzałka) poprzednia strona

Ustawienia

Want to rate or add this item to a list?

Zaloguj