diff --git a/front/src/AddBook.vue b/front/src/AddBook.vue
index 9f1a225..93c65ee 100644
--- a/front/src/AddBook.vue
+++ b/front/src/AddBook.vue
@@ -1,7 +1,7 @@
diff --git a/front/src/auth.store.js b/front/src/auth.store.js
index 21f14ab..f1c7f9d 100644
--- a/front/src/auth.store.js
+++ b/front/src/auth.store.js
@@ -1,5 +1,5 @@
import { defineStore } from 'pinia';
-import { useRouter } from 'vue-router'
+
export const useAuthStore = defineStore('auth', {
state: () => ({
@@ -15,7 +15,6 @@ export const useAuthStore = defineStore('auth', {
logout() {
this.user = null;
localStorage.removeItem('user');
- useRouter().push('/');
}
}
});
diff --git a/front/src/main.js b/front/src/main.js
index 29f892d..65de129 100644
--- a/front/src/main.js
+++ b/front/src/main.js
@@ -1,13 +1,8 @@
import { createApp } from 'vue'
import { createI18n } from "vue-i18n";
import { createPinia } from 'pinia'
-import { createRouter, createWebHistory } from 'vue-router'
+import { router } from './router.js'
import App from './App.vue'
-import BooksBrowser from './BooksBrowser.vue'
-import AddBook from './AddBook.vue'
-import SignUp from './SignUp.vue'
-import LogIn from './LogIn.vue'
-import Home from './Home.vue'
import fr from './locales/fr.json';
import en from './locales/en.json';
@@ -21,19 +16,6 @@ const i18n = createI18n({
});
-const routes = [
- { path: '/', component: Home },
- { path: '/books', component: BooksBrowser },
- { path: '/add', component: AddBook },
- { path: '/signup', component: SignUp },
- { path: '/login', component: LogIn },
-]
-
-export const router = createRouter({
- history: createWebHistory(),
- routes,
-})
-
const pinia = createPinia()
createApp(App).use(i18n).use(pinia).use(router).mount('#app')
diff --git a/front/src/router.js b/front/src/router.js
new file mode 100644
index 0000000..e3a25ed
--- /dev/null
+++ b/front/src/router.js
@@ -0,0 +1,20 @@
+import { createRouter, createWebHistory } from 'vue-router'
+
+import BooksBrowser from './BooksBrowser.vue'
+import AddBook from './AddBook.vue'
+import SignUp from './SignUp.vue'
+import LogIn from './LogIn.vue'
+import Home from './Home.vue'
+
+const routes = [
+ { path: '/', component: Home },
+ { path: '/books', component: BooksBrowser },
+ { path: '/add', component: AddBook },
+ { path: '/signup', component: SignUp },
+ { path: '/login', component: LogIn },
+]
+
+export const router = createRouter({
+ history: createWebHistory(),
+ routes,
+})