TMDB podrška

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); } };

@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.

Ne možete pronaći film ili TV seriju? prijavite se da biste ga napravili.

Global

s focus the search bar
p otvorite izbornik profila
esc zatvori otvoreni prozor
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(desna strelica) idi na sljedeću sezonu
(left arrow) go to previous season

On TV episode pages

(desna strelica) idi na sljedeću epizodu
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a otvori aktivnost
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(desna strelica) sljedeća stranica
(left arrow) previous page

Postavke

Want to rate or add this item to a list?

Prijavi se