2018-08-28 22:50:22 +02:00
|
|
|
<template>
|
2022-01-04 19:58:06 +01:00
|
|
|
<ready>
|
2022-01-01 13:43:24 +01:00
|
|
|
<template v-if="authUser">
|
2022-02-13 22:57:33 +01:00
|
|
|
<TheNavigation/>
|
2022-01-01 13:43:24 +01:00
|
|
|
<content-auth/>
|
|
|
|
</template>
|
|
|
|
<content-link-share v-else-if="authLinkShare"/>
|
|
|
|
<no-auth-wrapper v-else>
|
|
|
|
<router-view/>
|
|
|
|
</no-auth-wrapper>
|
|
|
|
<Notification/>
|
2021-12-08 13:22:39 +01:00
|
|
|
|
2022-07-19 16:56:09 +02:00
|
|
|
<keyboard-shortcuts v-if="keyboardShortcutsActive"/>
|
2021-11-13 20:49:02 +01:00
|
|
|
</ready>
|
2018-08-28 22:50:22 +02:00
|
|
|
</template>
|
|
|
|
|
2021-12-08 13:22:39 +01:00
|
|
|
<script lang="ts" setup>
|
2022-06-23 03:08:35 +02:00
|
|
|
import {computed, watch, type Ref} from 'vue'
|
2021-12-08 13:22:39 +01:00
|
|
|
import {useRouter} from 'vue-router'
|
|
|
|
import {useRouteQuery} from '@vueuse/router'
|
|
|
|
import {useI18n} from 'vue-i18n'
|
2021-07-28 21:56:29 +02:00
|
|
|
import isTouchDevice from 'is-touch-device'
|
2021-12-08 13:22:39 +01:00
|
|
|
import {success} from '@/message'
|
|
|
|
|
|
|
|
import Notification from '@/components/misc/notification.vue'
|
|
|
|
import KeyboardShortcuts from './components/misc/keyboard-shortcuts/index.vue'
|
2022-02-13 22:57:33 +01:00
|
|
|
import TheNavigation from '@/components/home/TheNavigation.vue'
|
2021-12-08 13:22:39 +01:00
|
|
|
import ContentAuth from './components/home/contentAuth.vue'
|
|
|
|
import ContentLinkShare from './components/home/contentLinkShare.vue'
|
2021-12-21 09:02:03 +01:00
|
|
|
import NoAuthWrapper from '@/components/misc/no-auth-wrapper.vue'
|
2021-12-08 13:22:39 +01:00
|
|
|
import Ready from '@/components/misc/ready.vue'
|
2019-09-09 19:55:43 +02:00
|
|
|
|
2021-08-20 15:38:16 +02:00
|
|
|
import {setLanguage} from './i18n'
|
2021-08-11 21:08:18 +02:00
|
|
|
import AccountDeleteService from '@/services/accountDelete'
|
2021-12-08 13:22:39 +01:00
|
|
|
|
2022-09-24 15:20:40 +02:00
|
|
|
import {useBaseStore} from '@/stores/base'
|
2021-11-22 22:12:54 +01:00
|
|
|
import {useColorScheme} from '@/composables/useColorScheme'
|
2022-01-01 13:43:24 +01:00
|
|
|
import {useBodyClass} from '@/composables/useBodyClass'
|
2022-09-21 03:37:39 +02:00
|
|
|
import {useAuthStore} from './stores/auth'
|
2019-12-18 22:30:20 +01:00
|
|
|
|
2022-09-24 15:20:40 +02:00
|
|
|
const baseStore = useBaseStore()
|
2022-09-21 03:37:39 +02:00
|
|
|
const authStore = useAuthStore()
|
2021-12-08 13:22:39 +01:00
|
|
|
const router = useRouter()
|
|
|
|
|
2022-01-16 22:24:51 +01:00
|
|
|
useBodyClass('is-touch', isTouchDevice())
|
2022-09-24 15:20:40 +02:00
|
|
|
const keyboardShortcutsActive = computed(() => baseStore.keyboardShortcutsActive)
|
2021-12-08 13:22:39 +01:00
|
|
|
|
2022-09-21 03:37:39 +02:00
|
|
|
const authUser = computed(() => authStore.authUser)
|
|
|
|
const authLinkShare = computed(() => authStore.authLinkShare)
|
2021-12-08 13:22:39 +01:00
|
|
|
|
2022-05-23 07:23:59 +02:00
|
|
|
const {t} = useI18n({useScope: 'global'})
|
2021-12-08 13:22:39 +01:00
|
|
|
|
|
|
|
// setup account deletion verification
|
|
|
|
const accountDeletionConfirm = useRouteQuery('accountDeletionConfirm') as Ref<null | string>
|
|
|
|
watch(accountDeletionConfirm, async (accountDeletionConfirm) => {
|
|
|
|
if (accountDeletionConfirm === null) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
const accountDeletionService = new AccountDeleteService()
|
|
|
|
await accountDeletionService.confirm(accountDeletionConfirm)
|
|
|
|
success({message: t('user.deletion.confirmSuccess')})
|
2022-09-21 03:37:39 +02:00
|
|
|
authStore.refreshUserInfo()
|
2021-12-08 13:22:39 +01:00
|
|
|
}, { immediate: true })
|
|
|
|
|
2022-04-10 20:55:43 +02:00
|
|
|
// setup password reset redirect
|
2021-12-08 13:22:39 +01:00
|
|
|
const userPasswordReset = useRouteQuery('userPasswordReset') as Ref<null | string>
|
|
|
|
watch(userPasswordReset, (userPasswordReset) => {
|
|
|
|
if (userPasswordReset === null) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
localStorage.setItem('passwordResetToken', userPasswordReset)
|
|
|
|
router.push({name: 'user.password-reset.reset'})
|
|
|
|
}, { immediate: true })
|
|
|
|
|
|
|
|
// setup email verification redirect
|
|
|
|
const userEmailConfirm = useRouteQuery('userEmailConfirm') as Ref<null | string>
|
|
|
|
watch(userEmailConfirm, (userEmailConfirm) => {
|
|
|
|
if (userEmailConfirm === null) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
localStorage.setItem('emailConfirmToken', userEmailConfirm)
|
|
|
|
router.push({name: 'user.login'})
|
|
|
|
}, { immediate: true })
|
|
|
|
|
|
|
|
setLanguage()
|
|
|
|
useColorScheme()
|
2018-08-28 22:50:22 +02:00
|
|
|
</script>
|
2021-10-18 14:17:34 +02:00
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import '@/styles/global.scss';
|
2021-10-18 14:33:30 +02:00
|
|
|
</style>
|