cleaned up errors in go code
This commit is contained in:
@ -31,12 +31,15 @@ func AniListQuery(body interface{}, login bool) (json.RawMessage, string) {
|
||||
defer res.Body.Close()
|
||||
|
||||
returnedBody, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return nil, "Could not read the returned body."
|
||||
}
|
||||
|
||||
return returnedBody, res.Status
|
||||
}
|
||||
|
||||
func (a *App) GetAniListItem(aniId int, login bool) AniListGetSingleAnime {
|
||||
var user = a.GetAniListLoggedInUser()
|
||||
user := a.GetAniListLoggedInUser()
|
||||
|
||||
var neededVariables interface{}
|
||||
|
||||
@ -141,7 +144,7 @@ func (a *App) GetAniListItem(aniId int, login bool) AniListGetSingleAnime {
|
||||
returnedBody, status := AniListQuery(body, login)
|
||||
var post AniListGetSingleAnime
|
||||
|
||||
if status == "404 Not Found" && login == false {
|
||||
if status == "404 Not Found" && !login {
|
||||
return post
|
||||
}
|
||||
|
||||
@ -154,7 +157,7 @@ func (a *App) GetAniListItem(aniId int, login bool) AniListGetSingleAnime {
|
||||
log.Printf("Failed at unmarshal, %s\n", err)
|
||||
}
|
||||
|
||||
if login == false {
|
||||
if !login {
|
||||
post.Data.MediaList.UserID = user.Data.Viewer.ID
|
||||
post.Data.MediaList.Status = ""
|
||||
post.Data.MediaList.StartedAt.Year = 0
|
||||
@ -249,7 +252,7 @@ func (a *App) AniListSearch(query string) any {
|
||||
}
|
||||
|
||||
func (a *App) GetAniListUserWatchingList(page int, perPage int, sort string) AniListCurrentUserWatchList {
|
||||
var user = a.GetAniListLoggedInUser()
|
||||
user := a.GetAniListLoggedInUser()
|
||||
type Variables struct {
|
||||
Page int `json:"page"`
|
||||
PerPage int `json:"perPage"`
|
||||
|
Reference in New Issue
Block a user