Added pages titles

This commit is contained in:
Florian Sylvain
2022-12-23 20:44:52 +01:00
parent 96c3f596ae
commit 2c2b478d5e
+18 -2
View File
@@ -3,6 +3,7 @@ import Home from '@/views/Home.vue'
import Debug from '@/views/Debug.vue' import Debug from '@/views/Debug.vue'
import Login from '@/views/Login.vue' import Login from '@/views/Login.vue'
import { useAuthStore } from '@/stores/AuthStore' import { useAuthStore } from '@/stores/AuthStore'
import { nextTick } from 'vue'
const router = createRouter({ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
@@ -11,16 +12,25 @@ const router = createRouter({
path: '/', path: '/',
name: 'login', name: 'login',
component: Login, component: Login,
meta: {
title: 'GohCMS - Connexion'
}
}, },
{ {
path: '/debug', path: '/debug',
name: 'debug', name: 'debug',
component: Debug component: Debug,
meta: {
title: 'GohCMS - Debug'
}
}, },
{ {
path: '/home', path: '/home',
name: 'home', name: 'home',
component: Home component: Home,
meta: {
title: 'GohCMS - Accueil'
}
}, },
] ]
}) })
@@ -40,4 +50,10 @@ router.beforeEach(async (to, from) => {
} }
}) })
router.afterEach((to, from) => {
nextTick(() => {
document.title = to.meta.title as string ?? 'GohCMS'
})
})
export default router export default router