fix: Update frontend to use new /shows/recent and /stats/top-songs endpoints
This commit is contained in:
parent
ffce34f948
commit
2c9bf53407
1 changed files with 5 additions and 5 deletions
|
|
@ -23,13 +23,13 @@ interface Show {
|
||||||
interface Song {
|
interface Song {
|
||||||
id: number
|
id: number
|
||||||
title: string
|
title: string
|
||||||
times_played?: number
|
performance_count?: number
|
||||||
avg_rating?: number
|
avg_rating?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getRecentShows(): Promise<Show[]> {
|
async function getRecentShows(): Promise<Show[]> {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${getApiUrl()}/shows?limit=8&sort=date&order=desc`, {
|
const res = await fetch(`${getApiUrl()}/shows/recent?limit=8`, {
|
||||||
cache: 'no-store',
|
cache: 'no-store',
|
||||||
next: { revalidate: 60 }
|
next: { revalidate: 60 }
|
||||||
})
|
})
|
||||||
|
|
@ -43,7 +43,7 @@ async function getRecentShows(): Promise<Show[]> {
|
||||||
|
|
||||||
async function getTopSongs(): Promise<Song[]> {
|
async function getTopSongs(): Promise<Song[]> {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${getApiUrl()}/songs?limit=5&sort=times_played&order=desc`, {
|
const res = await fetch(`${getApiUrl()}/stats/top-songs?limit=5`, {
|
||||||
cache: 'no-store',
|
cache: 'no-store',
|
||||||
next: { revalidate: 300 }
|
next: { revalidate: 300 }
|
||||||
})
|
})
|
||||||
|
|
@ -182,9 +182,9 @@ export default async function Home() {
|
||||||
</span>
|
</span>
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<div className="font-medium truncate">{song.title}</div>
|
<div className="font-medium truncate">{song.title}</div>
|
||||||
{song.times_played && (
|
{song.performance_count && (
|
||||||
<div className="text-xs text-muted-foreground">
|
<div className="text-xs text-muted-foreground">
|
||||||
{song.times_played} performances
|
{song.performance_count} performances
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue