🐛 Fix circular import in router
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { createRouter, createWebHistory } from "vue-router";
|
||||
import { lastRoute } from "../store";
|
||||
import { shouldLogin } from "../store";
|
||||
import { ref, watch } from "vue";
|
||||
import TimetableView from "../views/TimetableView.vue";
|
||||
import SubstitutionView from "../views/SubstitutionView.vue";
|
||||
import HistoryView from "../views/HistoryView.vue";
|
||||
@ -47,9 +48,14 @@ const router = createRouter({
|
||||
],
|
||||
});
|
||||
|
||||
export let lastRoute = ref();
|
||||
router.beforeEach((_to, from) => {
|
||||
lastRoute.value = from;
|
||||
return true;
|
||||
});
|
||||
|
||||
watch(shouldLogin, (value) => {
|
||||
if (value) router.push("/login");
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
Reference in New Issue
Block a user