fix: sync check if user account is premium
This commit is contained in:
parent
19f5df4409
commit
9d6333477f
@ -66,16 +66,20 @@ export class SyncTxHelper {
|
|||||||
if (Date.now() - interval > SYNC_DELAY) {
|
if (Date.now() - interval > SYNC_DELAY) {
|
||||||
await BrowserStorage.set<number>(ObjectStoreKeys.SYNC_INTERVAL, Date.now());
|
await BrowserStorage.set<number>(ObjectStoreKeys.SYNC_INTERVAL, Date.now());
|
||||||
|
|
||||||
const loggedIn = await this.isLoggedIn();
|
const isPremiumUser = await this.isPremiumUser();
|
||||||
fnConsoleLog('SyncServerCommand->loggedIn', loggedIn);
|
fnConsoleLog('SyncServerCommand->isPremiumUser', isPremiumUser);
|
||||||
return loggedIn;
|
return isPremiumUser;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async isLoggedIn(): Promise<boolean> {
|
private static async isPremiumUser(): Promise<boolean> {
|
||||||
const token = await new TokenStorageGetCommand().execute();
|
const token = await new TokenStorageGetCommand().execute();
|
||||||
return !!token;
|
if (token) {
|
||||||
|
const accessToken = new TokenDecodeCommand(token?.access_token).execute();
|
||||||
|
return accessToken.data.role.includes(3);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getList(key: string): Promise<ObjDateIndex[]> {
|
static async getList(key: string): Promise<ObjDateIndex[]> {
|
||||||
|
Loading…
Reference in New Issue
Block a user