From dd8967a454d339a819f2b794c19d8e31505cab5f Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 1 Aug 2024 20:31:03 +0200 Subject: [PATCH] Adds logging --- apps/app/public/sw.js | 1 + apps/app/src/stores/Account.ts | 1 + apps/app/src/views/SigninRedirect.vue | 1 + 3 files changed, 3 insertions(+) diff --git a/apps/app/public/sw.js b/apps/app/public/sw.js index 484293f46..60ad6f2f7 100644 --- a/apps/app/public/sw.js +++ b/apps/app/public/sw.js @@ -15,6 +15,7 @@ self.addEventListener('message', (event) => { function setSession(session) { self.clients.matchAll().then((clients) => { clients.forEach((client) => { + console.log('Session', client.id, session); client.postMessage({ type: 'setSession', data: { session } }); }); }); diff --git a/apps/app/src/stores/Account.ts b/apps/app/src/stores/Account.ts index dc0b9d19f..abc57c7ef 100644 --- a/apps/app/src/stores/Account.ts +++ b/apps/app/src/stores/Account.ts @@ -123,6 +123,7 @@ export const useAccountStore = defineStore('account', { this.setTheme(config); }, async onServiceWorkerMessage(event: MessageEvent) { + console.log('SW Message', event); switch (event.data.type) { case 'setSession': await this.setSession(event.data.data.session); diff --git a/apps/app/src/views/SigninRedirect.vue b/apps/app/src/views/SigninRedirect.vue index 7a4b62ca8..7e12c061a 100644 --- a/apps/app/src/views/SigninRedirect.vue +++ b/apps/app/src/views/SigninRedirect.vue @@ -48,6 +48,7 @@ export default defineComponent({ // Start listening for signed_in event else { const { data, error } = await supabase.auth.getSession(); + console.log({ data }); if (error) throw new Error(error.message); navigator.serviceWorker.controller?.postMessage({ action: 'setSession',