Skip to content

Commit

Permalink
Adds logging
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpolman committed Aug 1, 2024
1 parent 96b4ede commit dd8967a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/app/public/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 } });
});
});
Expand Down
1 change: 1 addition & 0 deletions apps/app/src/stores/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions apps/app/src/views/SigninRedirect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit dd8967a

Please sign in to comment.