mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 08:43:48 +03:00
organize code
This commit is contained in:
parent
ab5e6c1f7a
commit
8b8494ee64
@ -99,14 +99,17 @@ export class HydraApi {
|
|||||||
err instanceof AxiosError &&
|
err instanceof AxiosError &&
|
||||||
(err?.response?.status === 401 || err?.response?.status === 403)
|
(err?.response?.status === 401 || err?.response?.status === 403)
|
||||||
) {
|
) {
|
||||||
this.userAuth.authToken = "";
|
this.userAuth = {
|
||||||
this.userAuth.expirationTimestamp = 0;
|
authToken: "",
|
||||||
|
expirationTimestamp: 0,
|
||||||
|
refreshToken: "",
|
||||||
|
};
|
||||||
|
|
||||||
|
userAuthRepository.delete({ id: 1 });
|
||||||
|
|
||||||
if (WindowManager.mainWindow) {
|
if (WindowManager.mainWindow) {
|
||||||
WindowManager.mainWindow.webContents.send("on-signout");
|
WindowManager.mainWindow.webContents.send("on-signout");
|
||||||
}
|
}
|
||||||
|
|
||||||
userAuthRepository.delete({ id: 1 });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
@ -132,12 +135,12 @@ export class HydraApi {
|
|||||||
return this.instance.post(url, data, this.getAxiosConfig());
|
return this.instance.post(url, data, this.getAxiosConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
static async put(url, data?: any) {
|
static async put(url: string, data?: any) {
|
||||||
await this.revalidateAccessTokenIfExpired();
|
await this.revalidateAccessTokenIfExpired();
|
||||||
return this.instance.put(url, data, this.getAxiosConfig());
|
return this.instance.put(url, data, this.getAxiosConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
static async patch(url, data?: any) {
|
static async patch(url: string, data?: any) {
|
||||||
await this.revalidateAccessTokenIfExpired();
|
await this.revalidateAccessTokenIfExpired();
|
||||||
return this.instance.patch(url, data, this.getAxiosConfig());
|
return this.instance.patch(url, data, this.getAxiosConfig());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user