untuk halaman dashboard/page.tsx
ketika dapat akses token masuk ketika login
maka dashboard/page.tsx
akan otomatis get data dari endpont
https://api.usky.ai/home ini methodnya get
auth type bearer token
jika berhsil mncul response sperti data.json
dan component latest film ngambil dari response pasted-text.txt dari bagian reponse data.json
jika gagal
{
"status": false,
"message": "failed"
}
Now let me search for components that render the film data:
Now I understand the structure. I need to update dashboard/page.tsx to fetch data from the API endpoint and pass it to the components. Let me make the necessary changes:
Now I need to update the LatestAwards component to accept the new data format with the API fields:
I've implemented the API data fetching for the dashboard. Here's what I've done:
Changes Made:
Dashboard Page (/app/dashboard/page.tsx):
useState and useEffect hooks to manage API data fetchinghttps://api.usky.ai/home with Bearer token authentication when the page loadsdata.list.latest array from the API responsename, image_url, synopsis, cats) to component format (title, image, description, category)LatestAwards Component (/components/latest-awards.tsx):
name or title, image_url or image, synopsis or description)The dashboard now automatically fetches latest films from the API when users log in with a valid token, displays them in all sections (Latest Films, Latest Clip, Latest Awards), and shows an error message if the fetch fails.
Now let me check the full API response structure to understand the series field:
Let me search for the "series" field in the JSON response:
Now I understand the series data structure. Let me update the dashboard/page.tsx to fetch and display the series data from the API response:
Now let me update the Latest Series section to use the fetched data:
I've successfully implemented the series data fetching from the API. The dashboard now:
data.series array when the page loadslatestSeries state alongside the existing latestFilmsname, image_url, run_time_format, years) to component displayThe implementation maintains backward compatibility with the existing mock series while seamlessly integrating the real API data.
di dashboard/page.tsx
untuk data "Latest Series" di ambil dari respose data
bagian "series": [
untuk nama film dari name,episode dari data asset_name
dan untuk waktu pake run_time_format
jangan ubah tampilannya tetap seperti sekarang yang bedanya sekrang sudah intergare api di bagian "Latest Series"