mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-15 04:32:13 +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() {
|
private static async revalidateAccessTokenIfExpired() {
|
||||||
if (!this.userAuth.authToken) {
|
if (!this.userAuth.authToken) {
|
||||||
userAuthRepository.delete({ id: 1 });
|
userAuthRepository.delete({ id: 1 });
|
||||||
logger.error("user is not logged in");
|
logger.error("user is not logged in");
|
||||||
|
this.sendSignOutEvent();
|
||||||
throw new Error("user is not logged in");
|
throw new Error("user is not logged in");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,9 +158,7 @@ export class HydraApi {
|
||||||
|
|
||||||
userAuthRepository.delete({ id: 1 });
|
userAuthRepository.delete({ id: 1 });
|
||||||
|
|
||||||
if (WindowManager.mainWindow) {
|
this.sendSignOutEvent();
|
||||||
WindowManager.mainWindow.webContents.send("on-signout");
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.log("user refresh token expired");
|
logger.log("user refresh token expired");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue