landing desktop
This commit is contained in:
+8
-5
@@ -1,10 +1,12 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { useProfileModalStore } from '@/stores/profile-modal';
|
||||
import { loginRouteWithRedirect } from '@/utils/auth-redirect';
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{ path: '/', redirect: '/login' },
|
||||
{ path: '/', redirect: '/app' },
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
@@ -21,13 +23,11 @@ const router = createRouter({
|
||||
path: '/app',
|
||||
name: 'app-home',
|
||||
component: () => import('@/views/app/AppHomeView.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/app/businesses/:id',
|
||||
name: 'app-business-detail',
|
||||
component: () => import('@/views/app/AppBusinessDetailView.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/app/bookings',
|
||||
@@ -38,8 +38,11 @@ const router = createRouter({
|
||||
{
|
||||
path: '/app/profile',
|
||||
name: 'app-profile',
|
||||
component: () => import('@/views/app/AppProfileView.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
redirect: () => {
|
||||
useProfileModalStore().open();
|
||||
return { name: 'app-home' };
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/app/register-business',
|
||||
@@ -65,7 +68,7 @@ router.beforeEach(async (to) => {
|
||||
}
|
||||
|
||||
if (to.meta.requiresAuth && !auth.isLoggedIn) {
|
||||
return { name: 'login' };
|
||||
return loginRouteWithRedirect(to.fullPath);
|
||||
}
|
||||
|
||||
if (to.meta.requiresBusinessOwner && !auth.isBusinessOwner && !auth.isAdmin) {
|
||||
|
||||
Reference in New Issue
Block a user