This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import 'dotenv/config';
|
||||
import dotenv from 'dotenv';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
dotenv.config({ path: fileURLToPath(new URL('../../../../../../.env', import.meta.url)) });
|
||||
|
||||
import { createDatabase } from '../../../infrastructure/database/client.js';
|
||||
import { createUserRepository } from '../repositories/user-repository.js';
|
||||
|
||||
@@ -9,7 +9,7 @@ import LoginPage from '@/pages/LoginPage.vue';
|
||||
import { useAuth } from '@/composables/useAuth.js';
|
||||
import AdminImagePage from '@/pages/AdminImagePage.vue';
|
||||
|
||||
export default createRouter({
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{ path: '/', name: 'catalog', component: CatalogPage },
|
||||
@@ -27,6 +27,8 @@ export default createRouter({
|
||||
],
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
const auth = useAuth();
|
||||
router.beforeEach(async (to) => {
|
||||
if (!to.path.startsWith('/admin')) return true;
|
||||
|
||||
Reference in New Issue
Block a user