added timestamps to messages

This commit is contained in:
2025-12-15 17:33:13 +01:00
parent 0714088d4b
commit 5c1f5ab16b
5 changed files with 41 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
import { createRouter, createWebHistory } from 'vue-router'
import { initAuth } from '../stores/auth.ts'
import { initAuth, validateToken } from '../stores/auth.ts'
import LoginPage from '../pages/LoginPage.vue'
import RoomsPage from '../pages/RoomsPage.vue'
@@ -16,9 +16,15 @@ const router = createRouter({
router.beforeEach(async (to) => {
const auth = await initAuth()
if (!auth.isAuthenticated && to.path !== '/login') {
return '/login'
}
if (auth.isAuthenticated) {
const valid = await validateToken()
if (!valid) return '/login'
}
})
export default router