clear electron store on logout

This commit is contained in:
Rushikesh Tote 2022-06-17 12:05:34 +05:30
parent 17dd41152e
commit 6cef335264
2 changed files with 12 additions and 0 deletions

View file

@ -19,6 +19,9 @@ import {
} from 'types/user';
import { getFamilyData, isPartOfFamily } from 'utils/billing';
import { ServerErrorCodes } from 'utils/error';
import isElectron from 'is-electron';
import { runningInBrowser } from '../utils/common';
import { ElectronAPIsInterface } from '../types/electron';
const ENDPOINT = getEndpoint();
@ -121,6 +124,14 @@ export const logoutUser = async () => {
// ignore
}
await clearFiles();
if (isElectron()) {
const ElectronAPIs = (runningInBrowser() &&
window['ElectronAPIs']) as ElectronAPIsInterface;
if (ElectronAPIs && ElectronAPIs.clearElectronStore) {
ElectronAPIs.clearElectronStore();
}
}
router.push(PAGES.ROOT);
} catch (e) {
logError(e, 'logoutUser failed');

View file

@ -62,4 +62,5 @@ export interface ElectronAPIsInterface {
) => Promise<void>
) => void;
doesFolderExists: (dirPath: string) => Promise<boolean>;
clearElectronStore: () => void;
}