2023-09-20 17:34:33 +02:00
|
|
|
<script setup>
|
|
|
|
import { RouterView } from 'vue-router'
|
2023-10-07 17:15:41 +02:00
|
|
|
const route = useRoute()
|
2023-11-30 13:18:35 +01:00
|
|
|
const kickUser = ref(null)
|
2023-10-07 17:15:41 +02:00
|
|
|
const kickUserAfter = ref(null)
|
2023-11-30 13:18:35 +01:00
|
|
|
const isProtectedRoute = ref(route.meta.watchedByKicker)
|
2023-10-04 09:30:05 +02:00
|
|
|
|
2023-10-07 17:15:41 +02:00
|
|
|
watch(
|
|
|
|
() => route.name,
|
|
|
|
() => {
|
2023-11-30 13:18:35 +01:00
|
|
|
isProtectedRoute.value = route.meta.watchedByKicker
|
2023-10-07 17:15:41 +02:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2023-11-30 13:18:35 +01:00
|
|
|
// const kickInactiveUser = computed(() => kickUser && kickUserAfter.value > 0 && isProtectedRoute.value)
|
2023-10-07 17:15:41 +02:00
|
|
|
|
|
|
|
onBeforeMount(async () => {
|
|
|
|
const { useUserStore } = await import('./stores/user.js')
|
2023-10-04 09:30:05 +02:00
|
|
|
const { language } = useNavigatorLanguage()
|
2023-10-07 17:15:41 +02:00
|
|
|
const user = useUserStore()
|
|
|
|
|
|
|
|
kickUserAfter.value = parseInt(user.preferences.kickUserAfter)
|
2023-11-30 13:18:35 +01:00
|
|
|
kickUser.value = user.isAuthenticated
|
2023-10-07 17:15:41 +02:00
|
|
|
|
|
|
|
watch(
|
|
|
|
() => user.preferences.kickUserAfter,
|
|
|
|
() => {
|
|
|
|
kickUserAfter.value = parseInt(user.preferences.kickUserAfter)
|
|
|
|
}
|
|
|
|
)
|
2023-11-30 13:18:35 +01:00
|
|
|
watch(
|
|
|
|
() => user.isAuthenticated,
|
|
|
|
() => {
|
|
|
|
kickUser.value = user.isAuthenticated
|
|
|
|
}
|
|
|
|
)
|
2023-10-04 09:30:05 +02:00
|
|
|
watch(language, () => {
|
2023-10-07 17:15:41 +02:00
|
|
|
user.applyLanguage()
|
2023-10-04 09:30:05 +02:00
|
|
|
})
|
|
|
|
})
|
2023-10-07 17:15:41 +02:00
|
|
|
|
2023-09-20 17:34:33 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-10-25 17:26:32 +02:00
|
|
|
<notifications
|
|
|
|
id="vueNotification"
|
|
|
|
role="alert"
|
|
|
|
width="100%"
|
|
|
|
position="top"
|
|
|
|
:duration="4000"
|
|
|
|
:speed="0"
|
|
|
|
:max="1"
|
2023-11-29 09:28:54 +01:00
|
|
|
classes="notification notification-banner is-radiusless" />
|
2023-09-20 17:34:33 +02:00
|
|
|
<main class="main-section">
|
|
|
|
<RouterView />
|
|
|
|
</main>
|
2023-11-30 13:18:35 +01:00
|
|
|
<kicker v-if="kickUser && kickUserAfter > 0 && isProtectedRoute" :kickAfter="kickUserAfter"></kicker>
|
2023-09-20 17:34:33 +02:00
|
|
|
</template>
|