init
This commit is contained in:
@@ -41,6 +41,12 @@ const router = createRouter({
|
||||
path: '/',
|
||||
component: AppLayout,
|
||||
children: [
|
||||
{
|
||||
path: ':serverId([0-9a-fA-F-]{36})',
|
||||
name: 'server-invite',
|
||||
component: () => import('@/pages/server/invite.vue'),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
name: 'home',
|
||||
@@ -101,7 +107,10 @@ router.beforeEach(async (to) => {
|
||||
|
||||
if (authRequired && !authStore.isAuthenticated) {
|
||||
// Non connecté -> Login
|
||||
return '/auth/login'
|
||||
if (to.name === 'server-invite') {
|
||||
return {name: 'join', query: {serverId: String(to.params.serverId)}}
|
||||
}
|
||||
return {name: 'login', query: {redirect: to.fullPath}}
|
||||
} else if (to.name === 'login' && authStore.isAuthenticated) {
|
||||
// Déjà connecté -> Accueil
|
||||
return '/'
|
||||
|
||||
Reference in New Issue
Block a user