From b305154715272b35811bdfe5db2ba3ccf1685b90 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 1 Dec 2022 18:14:51 -0500 Subject: [PATCH] Add onLogout method to desktop bridge --- app/stores/AuthStore.ts | 4 ++++ app/typings/window.d.ts | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/app/stores/AuthStore.ts b/app/stores/AuthStore.ts index 8cc3e3e9b..3f745098d 100644 --- a/app/stores/AuthStore.ts +++ b/app/stores/AuthStore.ts @@ -10,6 +10,7 @@ import Team from "~/models/Team"; import User from "~/models/User"; import env from "~/env"; import { client } from "~/utils/ApiClient"; +import Desktop from "~/utils/Desktop"; import Storage from "~/utils/Storage"; const AUTH_STORE = "AUTH_STORE"; @@ -325,5 +326,8 @@ export default class AuthStore { this.team = null; this.policies = []; this.token = null; + + // Tell the host application we logged out, if any – allows window cleanup. + Desktop.bridge?.onLogout?.(); }; } diff --git a/app/typings/window.d.ts b/app/typings/window.d.ts index e8dd0a084..8442161ca 100644 --- a/app/typings/window.d.ts +++ b/app/typings/window.d.ts @@ -31,6 +31,11 @@ declare global { */ onTitlebarDoubleClick: () => Promise; + /** + * Passes log out events from the app to the main process + */ + onLogout: () => Promise; + /** * Adds a custom host to config */