From 3b770bbd4be17e6018be371f60796664a86a0561 Mon Sep 17 00:00:00 2001 From: Niklas Widmann Date: Mon, 12 Aug 2024 16:53:22 +0200 Subject: [PATCH] remember redirect on login & improve sentry compatibility --- components/Nav.vue | 5 ++++- composables/auth.ts | 11 +++++++++++ pages/login.vue | 8 +++++--- plugins/sentry.ts | 13 ++++++++++--- server/plugins/sentry.ts | 20 ++++++++++++++++++++ 5 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 server/plugins/sentry.ts diff --git a/components/Nav.vue b/components/Nav.vue index aaeee54..cd467c1 100644 --- a/components/Nav.vue +++ b/components/Nav.vue @@ -7,13 +7,14 @@
- Login + Login
diff --git a/composables/auth.ts b/composables/auth.ts index 2b74adb..6859dec 100644 --- a/composables/auth.ts +++ b/composables/auth.ts @@ -1,13 +1,24 @@ import { MeDocument, Permission, type SelfFragment } from '~/graphql/generated' +function refresh() { + const apollo = useApolloClient() + apollo.client.refetchQueries({ include: 'all' }) +} + export function login(token: string) { const cookie = useToken() cookie.value = token + + refresh() } export function logout() { const cookie = useToken() cookie.value = null + + if (import.meta.client) { + window.location.reload() + } } interface Session { diff --git a/pages/login.vue b/pages/login.vue index 9ed96fa..d8cfe8b 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -1,6 +1,6 @@