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