timetracker update
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
|
||||
import Default from '@/layouts/default.vue'
|
||||
import Empty from '@/layouts/empty.vue'
|
||||
import { currentLang, initLangs, langs } from './langs'
|
||||
import { currentLang, langs } from './langs'
|
||||
import { getSettings } from './settings'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import Default from '@/layouts/default.vue'
|
||||
|
||||
// Helper: read the non-HTTPOnly is_authenticated cookie set by the backend.
|
||||
// The backend sets it to "1" on login and removes it on logout.
|
||||
@@ -13,7 +13,6 @@ function isAuthenticated(): boolean {
|
||||
}
|
||||
|
||||
|
||||
await initLangs()
|
||||
await getSettings()
|
||||
|
||||
|
||||
@@ -27,18 +26,17 @@ const router = createRouter({
|
||||
{
|
||||
path: '/:locale',
|
||||
children: [
|
||||
// {
|
||||
// path: '',
|
||||
// component: Default,
|
||||
// children: [
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
path: '',
|
||||
component: Default,
|
||||
children: [
|
||||
{ path: '', component: () => import('../views/RepoChartView.vue'), name: 'home' },
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
component: Empty,
|
||||
children: [
|
||||
{ path: '', component: () => import('../views/HomeView.vue'), name: 'home' },
|
||||
{ path: 'chart', component: () => import('../views/RepoChartView.vue'), name: 'chart' },
|
||||
{ path: 'login', component: () => import('@/views/LoginView.vue'), name: 'login', meta: { guest: true } },
|
||||
{ path: 'register', component: () => import('@/views/RegisterView.vue'), name: 'register', meta: { guest: true } },
|
||||
{ path: 'password-recovery', component: () => import('@/views/PasswordRecoveryView.vue'), name: 'password-recovery', meta: { guest: true } },
|
||||
@@ -58,6 +56,9 @@ router.beforeEach((to, from, next) => {
|
||||
|
||||
// Check if the locale is valid
|
||||
if (locale && langs.length > 0) {
|
||||
const authStore = useAuthStore()
|
||||
console.log(authStore.isAuthenticated,to, from)
|
||||
// if()
|
||||
const validLocale = langs.find((l) => l.lang_code === locale)
|
||||
|
||||
if (validLocale) {
|
||||
|
||||
Reference in New Issue
Block a user