Fix some request bugs

This commit is contained in:
daru
2022-04-30 12:23:46 +02:00
parent 10c9997160
commit 054afd8376
3 changed files with 16 additions and 6 deletions

10
ober.go
View File

@@ -185,6 +185,7 @@ func UserGet(ctx *fasthttp.RequestCtx) {
func WatchGet(ctx *fasthttp.RequestCtx) {
animeUsers, err := watchGetLogic(ctx)
if err != nil {
addErrorToCtx(ctx, err)
return
}
@@ -330,9 +331,11 @@ func UnRegister(ctx *fasthttp.RequestCtx) {
// DELETE
err = DeleteUserFromAnimes(register.MalID)
if err != nil {
ctx.WriteString(err.Error())
ctx.SetStatusCode(fasthttp.StatusNotFound)
return
if err != nutsdb.ErrBucketEmpty {
ctx.WriteString(err.Error())
ctx.SetStatusCode(fasthttp.StatusNotFound)
return
}
}
err = DbDelete(bucketUsers, register.Username)
if err != nil {
@@ -389,6 +392,7 @@ func watchGetLogic(ctx *fasthttp.RequestCtx) ([]AnimeUser, error) {
addErrorToCtx(ctx, err)
return nil, err
}
err = nil
animesUsers = make([]AnimeUser, 0)
}