Fixed Simkl Bugs

This commit is contained in:
2024-08-18 17:23:09 -04:00
parent 6ebf5ac48e
commit 4d9012b43c
13 changed files with 280 additions and 157 deletions

View File

@ -181,10 +181,26 @@ func (a *App) GetSimklLoggedInUser() SimklUser {
defer response.Body.Close()
var user SimklUser
respBody, _ := io.ReadAll(response.Body)
var errCheck struct {
Error string `json:"error"`
Message string `json:"message"`
}
err = json.Unmarshal(respBody, &errCheck)
if err != nil {
log.Printf("Failed at unmarshal, %s\n", err)
}
if errCheck.Error != "" {
a.LogoutSimkl()
return SimklUser{}
}
var user SimklUser
err = json.Unmarshal(respBody, &user)
if err != nil {
log.Printf("Failed at unmarshal, %s\n", err)