fix: added invalid page
This commit is contained in:
parent
ec4ea4c0a1
commit
cce028d0a1
@ -7,5 +7,5 @@
|
||||
|
||||
<script setup>
|
||||
import DesktopLayout from '@/components/DesktopLayout.vue'
|
||||
import { sessionStore as session } from '@/stores/session';
|
||||
import { sessionStore as session } from '@/stores/session'
|
||||
</script>
|
||||
|
||||
17
frontend/src/pages/InvalidPage.vue
Normal file
17
frontend/src/pages/InvalidPage.vue
Normal file
@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<div
|
||||
class="grid h-full place-items-center px-4 py-20 text-center text-lg text-gray-600"
|
||||
>
|
||||
<div class="space-y-2">
|
||||
<div>Invalid page or not permitted to access</div>
|
||||
<Button :route="{ name: 'Leads' }">
|
||||
<template #prefix><LeadsIcon class="w-4" /></template>
|
||||
Leads
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import LeadsIcon from '@/components/Icons/LeadsIcon.vue'
|
||||
</script>
|
||||
@ -26,6 +26,11 @@ const routes = [
|
||||
name: 'Dashboard',
|
||||
component: () => import('@/pages/Dashboard.vue'),
|
||||
},
|
||||
{
|
||||
path: '/:invalidpath',
|
||||
name: 'Invalid Page',
|
||||
component: () => import('@/pages/InvalidPage.vue'),
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
@ -48,6 +53,8 @@ router.beforeEach(async (to, from, next) => {
|
||||
next({ name: 'Leads' })
|
||||
} else if (to.name !== 'Login' && !session.isLoggedIn) {
|
||||
next({ name: 'Login' })
|
||||
} else if (to.matched.length === 0) {
|
||||
next({ name: 'Invalid Page' })
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user