aboutsummaryrefslogtreecommitdiffstats
path: root/apps/mobile/lib/session.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/mobile/lib/session.ts')
-rw-r--r--apps/mobile/lib/session.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/mobile/lib/session.ts b/apps/mobile/lib/session.ts
index bafb3a09..8eb646cb 100644
--- a/apps/mobile/lib/session.ts
+++ b/apps/mobile/lib/session.ts
@@ -1,12 +1,18 @@
import { useCallback } from "react";
import useAppSettings from "./settings";
+import { api } from "./trpc";
export function useSession() {
const { settings, setSettings } = useAppSettings();
+ const { mutate: deleteKey } = api.apiKeys.revoke.useMutation();
+
const logout = useCallback(() => {
- setSettings({ ...settings, apiKey: undefined });
+ if (settings.apiKeyId) {
+ deleteKey({ id: settings.apiKeyId });
+ }
+ setSettings({ ...settings, apiKey: undefined, apiKeyId: undefined });
}, [settings, setSettings]);
return {