Provide a button to clear session data (#231)
Fixes #214 --------- Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
This commit is contained in:
12
src/ipc/handlers/session_handlers.ts
Normal file
12
src/ipc/handlers/session_handlers.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ipcMain, session } from "electron";
|
||||
|
||||
export const registerSessionHandlers = () => {
|
||||
ipcMain.handle("clear-session-data", async (_event) => {
|
||||
const defaultAppSession = session.defaultSession;
|
||||
|
||||
await defaultAppSession.clearStorageData({
|
||||
storages: ["cookies", "localstorage"],
|
||||
});
|
||||
console.info(`[IPC] All session data cleared for default session`);
|
||||
});
|
||||
};
|
||||
@@ -821,4 +821,8 @@ export class IpcClient {
|
||||
public async renameBranch(params: RenameBranchParams): Promise<void> {
|
||||
await this.ipcRenderer.invoke("rename-branch", params);
|
||||
}
|
||||
|
||||
async clearSessionData(): Promise<void> {
|
||||
return this.ipcRenderer.invoke("clear-session-data");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import { registerVersionHandlers } from "./handlers/version_handlers";
|
||||
import { registerLanguageModelHandlers } from "./handlers/language_model_handlers";
|
||||
import { registerReleaseNoteHandlers } from "./handlers/release_note_handlers";
|
||||
import { registerImportHandlers } from "./handlers/import_handlers";
|
||||
import { registerSessionHandlers } from "./handlers/session_handlers";
|
||||
|
||||
export function registerIpcHandlers() {
|
||||
// Register all IPC handlers by category
|
||||
@@ -39,4 +40,5 @@ export function registerIpcHandlers() {
|
||||
registerLanguageModelHandlers();
|
||||
registerReleaseNoteHandlers();
|
||||
registerImportHandlers();
|
||||
registerSessionHandlers();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user