Store refresh token in local storage
For convenience to not have to log in everytime after closing the tab, opening a new tab, closing the browser/pwa app. closes #1018
This commit is contained in:
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|||||||
- (**Theme**) Change "pure black mode" paper background color to true black
|
- (**Theme**) Change "pure black mode" paper background color to true black
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- (**General**) Preserve refresh token (UI Login) over sessions
|
||||||
- (**Theme**) Improve automatic theme background colors
|
- (**Theme**) Improve automatic theme background colors
|
||||||
- (**Theme**) Adjust "primary color" of dynamic color theme on manga pages
|
- (**Theme**) Adjust "primary color" of dynamic color theme on manga pages
|
||||||
- (**Theme**) Increase max length of custom theme names to 32 (previously 16)
|
- (**Theme**) Increase max length of custom theme names to 32 (previously 16)
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export class AuthManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static getRefreshToken(): string | null {
|
static getRefreshToken(): string | null {
|
||||||
return AppStorage.session.getItemParsed(AuthManager.REFRESH_TOKEN_KEY, null);
|
return AppStorage.local.getItemParsed(AuthManager.REFRESH_TOKEN_KEY, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getTokens(): { accessToken: string | null; refreshToken: string | null } {
|
static getTokens(): { accessToken: string | null; refreshToken: string | null } {
|
||||||
@@ -124,7 +124,7 @@ export class AuthManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static setRefreshToken(token: string): void {
|
static setRefreshToken(token: string): void {
|
||||||
AppStorage.session.setItem(AuthManager.REFRESH_TOKEN_KEY, token);
|
AppStorage.local.setItem(AuthManager.REFRESH_TOKEN_KEY, token);
|
||||||
AuthManager.notify();
|
AuthManager.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ export class AuthManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static removeRefreshToken(): void {
|
static removeRefreshToken(): void {
|
||||||
AppStorage.session.setItem(AuthManager.REFRESH_TOKEN_KEY, undefined);
|
AppStorage.local.setItem(AuthManager.REFRESH_TOKEN_KEY, undefined);
|
||||||
AuthManager.notify();
|
AuthManager.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user