diff --git a/AniListUserFunctions.go b/AniListUserFunctions.go index 1dbe2ee..71c4129 100644 --- a/AniListUserFunctions.go +++ b/AniListUserFunctions.go @@ -200,3 +200,18 @@ func (a *App) GetAniListLoggedInUser() AniListUser { return post } + +func (a *App) LogoutAniList() string { + if (AniListJWT{} != aniListJwt) { + err := aniRing.Remove("anilistTokenType") + err = aniRing.Remove("anilistTokenExpiresIn") + err = aniRing.Remove("anilistAccessToken") + err = aniRing.Remove("anilistRefreshToken") + + if err != nil { + fmt.Println("AniList Logout Failed", err) + } + } + + return "AniList Logged Out Successfully" +} diff --git a/MALUserFunctions.go b/MALUserFunctions.go index 63e133d..062598a 100644 --- a/MALUserFunctions.go +++ b/MALUserFunctions.go @@ -256,3 +256,18 @@ func (a *App) GetMyAnimeListLoggedInUser() MyAnimeListUser { return user } + +func (a *App) LogoutMyAnimeList() string { + if (MyAnimeListJWT{} != myAnimeListJwt) { + err := myAnimeListRing.Remove("MyAnimeListTokenType") + err = myAnimeListRing.Remove("MyAnimeListExpiresIn") + err = myAnimeListRing.Remove("MyAnimeListAccessToken") + err = myAnimeListRing.Remove("MyAnimeListRefreshToken") + + if err != nil { + fmt.Println("MAL Logout Failed", err) + } + } + + return "MAL Logged Out Successfully" +} diff --git a/SimklUserFunctions.go b/SimklUserFunctions.go index 9265c4e..7f89143 100644 --- a/SimklUserFunctions.go +++ b/SimklUserFunctions.go @@ -193,3 +193,17 @@ func (a *App) GetSimklLoggedInUser() SimklUser { return user } + +func (a *App) LogoutSimkl() string { + if (SimklJWT{} != simklJwt) { + err := simklRing.Remove("SimklTokenType") + err = simklRing.Remove("SimklAccessToken") + err = simklRing.Remove("SimklScope") + + if err != nil { + fmt.Println("Simkl Logout Failed", err) + } + } + + return "Simkl Logged Out Successfully" +} diff --git a/frontend/src/AvatarMenu.svelte b/frontend/src/AvatarMenu.svelte index 1d61755..e1880bc 100644 --- a/frontend/src/AvatarMenu.svelte +++ b/frontend/src/AvatarMenu.svelte @@ -2,7 +2,7 @@ import {Avatar} from "flowbite-svelte"; import type {AniListUser} from "./anilist/types/AniListTypes"; - import {aniListLoggedIn, aniListUser, malLoggedIn, simklLoggedIn,} from "./GlobalVariablesAndHelperFunctions.svelte" + import {aniListLoggedIn, aniListUser, malLoggedIn, simklLoggedIn, logoutOfAniList, logoutOfMAL, logoutOfSimkl} from "./GlobalVariablesAndHelperFunctions.svelte" import * as runtime from "../wailsjs/runtime"; let currentAniListUser: AniListUser @@ -43,7 +43,7 @@ aria-labelledby="dropdownUserAvatarButton"> {#if isAniListLoggedIn}