diff --git a/src/api/common.ts b/src/api/common.ts index ec3b7dff3..53afa16f5 100644 --- a/src/api/common.ts +++ b/src/api/common.ts @@ -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'); + } +}; diff --git a/src/preload.ts b/src/preload.ts index 4caa4fbcd..ed8045a10 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -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,