add clear electron store

This commit is contained in:
Rushikesh Tote 2022-06-17 11:12:37 +05:30
parent 5addfdd9ea
commit f098bcd3ed
2 changed files with 13 additions and 1 deletions

View file

@ -1,5 +1,6 @@
import { ipcRenderer } from 'electron/renderer';
import { logError } from '../utils/logging';
import { keysStore, uploadStatusStore, watchStore } from '../services/store';
export const selectRootDirectory = async () => {
try {
@ -8,3 +9,13 @@ export const selectRootDirectory = async () => {
logError(e, 'error while selecting root directory');
}
};
export const clearElectronStore = () => {
try {
watchStore.clear();
uploadStatusStore.clear();
keysStore.clear();
} catch (e) {
logError(e, 'error while clearing electron store');
}
};

View file

@ -29,7 +29,7 @@ import {
setExportRecord,
exists,
} from './api/export';
import { selectRootDirectory } from './api/common';
import { selectRootDirectory, clearElectronStore } from './api/common';
import { getElectronFile, doesFolderExists } from './services/fs';
const windowObject: any = window;
@ -41,6 +41,7 @@ windowObject['ElectronAPIs'] = {
saveStreamToDisk,
saveFileToDisk,
selectRootDirectory,
clearElectronStore,
sendNotification,
showOnTray,
reloadWindow,