edit business owner
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { useProfileModalStore } from '@/stores/profile-modal';
|
||||
import { useOwnedBusiness } from '@/composables/useOwnedBusiness';
|
||||
import { loginRouteWithRedirect } from '@/utils/auth-redirect';
|
||||
|
||||
const router = createRouter({
|
||||
@@ -79,6 +80,14 @@ router.beforeEach(async (to) => {
|
||||
return auth.isBusinessOwner ? { name: 'app-owner' } : { name: 'app-home' };
|
||||
}
|
||||
|
||||
if (to.name === 'app-business-detail' && auth.isBusinessOwner) {
|
||||
const { ensureLoaded, isOwnBusiness } = useOwnedBusiness();
|
||||
await ensureLoaded();
|
||||
if (isOwnBusiness(String(to.params.id))) {
|
||||
return { name: 'app-owner' };
|
||||
}
|
||||
}
|
||||
|
||||
if (to.meta.guest && auth.isLoggedIn) {
|
||||
return { name: 'app-home' };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user