Hey everyone, I’m a Vue.js newbie and I’m building a MyAnimeList clone to practice. I’m stuck trying to show anime titles using the MyAnimeList API from RapidAPI. I’ve set up the main page and a card component, but nothing’s showing up. Here’s what I’ve got so far:
I encountered a similar issue when working with external APIs in Vue. One thing that stands out is your API URL and headers. The ‘anime-database.example.com’ looks like a placeholder - make sure you’re using the correct RapidAPI endpoint for MyAnimeList.
Also, check the structure of the response data. Your AnimeCard component tries to access ‘showData.shows.name’, but based on your MainPage setup, it should probably be just ‘showData.name’.
Lastly, I’d recommend using axios instead of fetch for easier error handling. Don’t forget to check your browser’s console for any error messages - they can be incredibly helpful in pinpointing the issue.
If you’re still stuck, try logging the API response to see what data you’re actually receiving. It might not match the structure you’re expecting.
Hey MarkSeeker91, I’ve been down this road before with API integrations in Vue. A couple things to check:
First, make sure your RapidAPI credentials are correct. The x-api-key and x-host headers look off. For RapidAPI, you typically need ‘X-RapidAPI-Key’ and ‘X-RapidAPI-Host’ instead.
Also, the API endpoint you’re using (‘anime-database.example.com’) seems to be a placeholder. Double-check the actual MyAnimeList endpoint on RapidAPI.
In your AnimeCard component, you’re trying to access ‘showData.shows.name’. Based on how you’re passing the data, it should just be ‘showData.name’.
Lastly, consider adding some error handling and loading states. It’ll make debugging easier and improve user experience. Something like:
yo MarkSeeker91, i had similar probs. check ur API endpoint - ‘anime-database.example.com’ aint gonna work. Also, in AnimeCard, try {{ showData.name }} instead of {{ showData.shows.name }}. And maybe use a v-if on the card to make sure data’s there before rendering. good luck mate!