Aufräumen

This commit is contained in:
daru
2022-04-15 10:17:25 +02:00
parent c8e0b0af2d
commit 25259653e7
2 changed files with 18 additions and 15 deletions

20
ober.go
View File

@@ -26,19 +26,13 @@ func RunWebserv() {
}
func Start(ctx *fasthttp.RequestCtx) {
data, err := cache.Get(seasonApiJikan)
if err != nil {
addErrorToCtx(ctx, err)
return
}
var seasonData SeasonJikan
err = json.Unmarshal(data, &seasonData)
season, err := GetSeasonCache()
if err != nil {
addErrorToCtx(ctx, err)
return
}
WriteIndex(ctx, &seasonData)
WriteIndex(ctx, season)
ctx.SetContentType("text/html; charset=utf-8")
ctx.SetStatusCode(fasthttp.StatusOK)
@@ -50,12 +44,6 @@ func Season(ctx *fasthttp.RequestCtx) {
addErrorToCtx(ctx, err)
return
}
var seasonData SeasonJikan
err = json.Unmarshal(data, &seasonData)
if err != nil {
addErrorToCtx(ctx, err)
return
}
_, err = ctx.Write(data)
if err != nil {
@@ -201,7 +189,9 @@ func WatchPost(ctx *fasthttp.RequestCtx) {
}
for _, anime := range animes {
// TODO iterate animes
// TODO check if anime is in season
// iterate sent animes
detail, _, err := GetAnimeDetailData(anime.Anime)
if err != nil {
ctx.WriteString(err.Error())