fixed MAL not auto logging in when app starts

This commit is contained in:
2025-12-21 00:24:25 -05:00
parent 5c4caf68e6
commit 063c5016f3
2 changed files with 24 additions and 3 deletions

View File

@@ -308,7 +308,16 @@ func refreshMyAnimeListAuthorizationToken() {
func (a *App) GetMyAnimeListLoggedInUser() MyAnimeListUser {
a.MyAnimeListLogin()
user := createUser()
if user.Name == "" {
refreshMyAnimeListAuthorizationToken()
user = createUser()
}
return user
}
func createUser() MyAnimeListUser {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.myanimelist.net/v2/users/@me?fields=anime_statistics", nil)
@@ -335,6 +344,7 @@ func (a *App) GetMyAnimeListLoggedInUser() MyAnimeListUser {
}
return user
}
func (a *App) LogoutMyAnimeList() string {