From 68710d14d71fd6d5c9cef434d983d044dbae085b Mon Sep 17 00:00:00 2001 From: GivFNZ Date: Sat, 22 Mar 2025 18:13:51 -0300 Subject: [PATCH] ref: lastfm: show last update and reduce limit --- package.json | 2 +- src/api/lastfm.ts | 16 ++++++++++++++-- src/components/Footer/index.tsx | 2 +- src/pages/music/index.tsx | 5 +++-- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 3e965b4..3bbffee 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "givs-website-react", "private": true, - "version": "1.2.3", + "version": "1.2.4", "type": "module", "scripts": { "dev": "vite", diff --git a/src/api/lastfm.ts b/src/api/lastfm.ts index 58b172c..ca8a1a5 100644 --- a/src/api/lastfm.ts +++ b/src/api/lastfm.ts @@ -15,8 +15,19 @@ export interface getRecentTracksResponse { mbid: string, name: string, url: string, + date: { + uts: string, + "#text": string + } } - ] + ], + "@attr": { + user: string, + totalPages: string, + page: string, + perPage: string, + total: string + } } } @@ -26,7 +37,8 @@ export async function getRecentTracks() { api_key, method: 'user.getrecenttracks', user: 'givfnz', - format: 'json' + format: 'json', + limit: 1 } }) return response.data diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx index bae8ba2..a5a484a 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer/index.tsx @@ -2,7 +2,7 @@ export default function Footer() { return ( ) } \ No newline at end of file diff --git a/src/pages/music/index.tsx b/src/pages/music/index.tsx index 248e271..80a2b1d 100644 --- a/src/pages/music/index.tsx +++ b/src/pages/music/index.tsx @@ -14,9 +14,10 @@ export default function Music() { return (

{t("myLast")}

-

{t("myLastDescription")}

+

{t("myLastDescription")}

{lastResponse?.recenttracks?.track[0].name} - {lastResponse?.recenttracks?.track[0].artist["#text"]} - {t("lastLink")} + {t("lastLink")} + Last update: {lastResponse?.recenttracks?.track[0]?.date["#text"]} UTC
) } \ No newline at end of file