mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-14 20:22:10 +00:00
fix: send signout event when auth token is empty
This commit is contained in:
parent
7be626b3dd
commit
a3f7d3c59e
1 changed files with 8 additions and 3 deletions
|
@ -106,10 +106,17 @@ export class HydraApi {
|
|||
};
|
||||
}
|
||||
|
||||
private static sendSignOutEvent() {
|
||||
if (WindowManager.mainWindow) {
|
||||
WindowManager.mainWindow.webContents.send("on-signout");
|
||||
}
|
||||
}
|
||||
|
||||
private static async revalidateAccessTokenIfExpired() {
|
||||
if (!this.userAuth.authToken) {
|
||||
userAuthRepository.delete({ id: 1 });
|
||||
logger.error("user is not logged in");
|
||||
this.sendSignOutEvent();
|
||||
throw new Error("user is not logged in");
|
||||
}
|
||||
|
||||
|
@ -151,9 +158,7 @@ export class HydraApi {
|
|||
|
||||
userAuthRepository.delete({ id: 1 });
|
||||
|
||||
if (WindowManager.mainWindow) {
|
||||
WindowManager.mainWindow.webContents.send("on-signout");
|
||||
}
|
||||
this.sendSignOutEvent();
|
||||
|
||||
logger.log("user refresh token expired");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue