Previous and Next episode number is taken from array
If there is episode "skips" in database now should work with them too.
This commit is contained in:
@ -33,11 +33,14 @@ func Get(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusNotFound, "Anime episodes not found", err)
|
||||
}
|
||||
|
||||
episode := animeEpisodes.Find(episodeNumber)
|
||||
episode, _ := animeEpisodes.Find(episodeNumber)
|
||||
|
||||
if episode == nil {
|
||||
return ctx.Error(http.StatusNotFound, "Anime episode not found", nil)
|
||||
}
|
||||
|
||||
return ctx.HTML(components.AnimeEpisode(anime, episode, user))
|
||||
_, previousIndex := animeEpisodes.Find(episodeNumber - 1)
|
||||
_, nextIndex := animeEpisodes.Find(episodeNumber + 1)
|
||||
|
||||
return ctx.HTML(components.AnimeEpisode(anime, episode, user, previousIndex, nextIndex))
|
||||
}
|
||||
|
Reference in New Issue
Block a user