Fixed on more homepage error

This commit is contained in:
Dmitriy Shishkov 2023-08-16 00:18:22 +03:00
parent 1a51c580d4
commit 48f6059bbd
Signed by: dm1sh
GPG Key ID: 027994B0AA357688

View File

@ -33,12 +33,12 @@ function fallbackGenerateStories(announcements: UseFetchReturn<Announcement[]>)
return fallbackStory(announcements.error, true)
}
const stories = generateStories(announcements.data, announcements.refetch)
if (stories.length === 0) {
if (announcements.data.length === 0) {
return [{ url: '/static/empty.png' }]
}
const stories = generateStories(announcements.data, announcements.refetch)
return stories
}
@ -88,7 +88,7 @@ function HomePage() {
/>
<div style={styles.container}>
<Stories
currentIndex={index.n}
currentIndex={index.n % stories.length}
onStoryEnd={index.increment}
onNext={index.increment}
onPrevious={index.decrement}