diff --git a/apps/frontend/src/api/userChatSettings.ts b/apps/frontend/src/api/userChatSettings.ts index 69937ab..10a35ed 100644 --- a/apps/frontend/src/api/userChatSettings.ts +++ b/apps/frontend/src/api/userChatSettings.ts @@ -32,6 +32,7 @@ export const saveUserChatSettings = async ({ const user_uuid = getUserUuid() const browser_uuid = getBrowserUuid() const _id = `user_chat_settings:${qr_code_uri}:${chat}:${user_chat_role}:${user_uuid}` + console.log('is_push_notification_enabled', is_push_notification_enabled) const result = await userChatSettingsDbRemote.upsert( _id, (doc): UserChatSettingsDocument | false => { diff --git a/apps/frontend/src/components/ChatSubscribeWebPush.vue b/apps/frontend/src/components/ChatSubscribeWebPush.vue index 274afa9..68e33a3 100644 --- a/apps/frontend/src/components/ChatSubscribeWebPush.vue +++ b/apps/frontend/src/components/ChatSubscribeWebPush.vue @@ -150,7 +150,7 @@ const stage = ref<'receivePushSubscription' | 'createPushSubscription' | 'remove const { isPending, isError, error, mutate } = useMutation({ mutationKey: [stage], mutationFn: async () => { - debug({ stage: stage.value }) + console.log({ stage: stage.value }) try { if (stage.value === 'receivePushSubscription') { const chatSettingsDocument = await getUserChatSettingsDocument({ @@ -159,13 +159,13 @@ const { isPending, isError, error, mutate } = useMutation({ user_chat_role, }).catch((error) => { if (!isNotFoundError(error)) { - debug('chatSettingsDocument error', error) + console.log('chatSettingsDocument error', error) throw error } - debug('chatSettingsDocument not found') // it's ok + console.log('chatSettingsDocument not found') // it's ok }) if (chatSettingsDocument) { - debug( + console.log( 'chatSettingsDocument.is_push_notification_enabled', chatSettingsDocument.is_push_notification_enabled, ) @@ -205,6 +205,7 @@ const { isPending, isError, error, mutate } = useMutation({ user_chat_role, is_push_notification_enabled: true, }) + stage.value = 'removePushSubscription' } else if (stage.value === 'removePushSubscription') { await saveUserChatSettings({ qr_code_uri, @@ -226,6 +227,7 @@ const { isPending, isError, error, mutate } = useMutation({ watch( [() => stage.value, () => enabled.value], () => { + console.log({ stage: stage.value, enabled: enabled.value }) if (stage.value === 'removePushSubscription') { if (!enabled.value) mutate() } else if (stage.value === 'createPushSubscription') { diff --git a/apps/frontend/src/constants/routes.ts b/apps/frontend/src/constants/routes.ts index 9f0914a..ad8becc 100644 --- a/apps/frontend/src/constants/routes.ts +++ b/apps/frontend/src/constants/routes.ts @@ -10,7 +10,6 @@ export const ROUTE_NAMES = { READ_QR_CODE: 'read-qr-code', DONATE: 'donate', PUBLIC_CHAT: 'public-chat', - APP_START: 'app-start', // CREATE_ACTIONS: 'create-actions', // MANAGE_SETTINGS: 'manage-settings', // MANAGE_PROFILE: 'manage-profile', diff --git a/apps/frontend/src/router/index.ts b/apps/frontend/src/router/index.ts index 2259684..d3c99b3 100644 --- a/apps/frontend/src/router/index.ts +++ b/apps/frontend/src/router/index.ts @@ -9,10 +9,12 @@ const routes = [ { path: '/', name: ROUTE_NAMES.HOME, - component: () => - isRunningStandalone() - ? import('@/views/manage/ManageQRCodesView.vue') - : import('@/views/HomeView.vue'), + component: () => import('@/views/HomeView.vue'), + beforeEnter() { + if (isRunningStandalone()) { + return { name: ROUTE_NAMES.MANAGE_DASHBOARD_QR } + } + }, }, { path: '/create', @@ -22,8 +24,7 @@ const routes = [ { path: '/manage', name: ROUTE_NAMES.MANAGE_DASHBOARD_QR_CODES, - component: () => import('@/views/manage/ManageQRCodesView.vue'), - props: true, + redirect: { name: ROUTE_NAMES.MANAGE_DASHBOARD_QR }, }, { path: '/manage/qr',