mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 14:56:01 +00:00
Merge pull request #996 from rommapp/fix-nav-guards-returns
Have navigation guards return true or explicitly call next
This commit is contained in:
@@ -77,12 +77,13 @@ const router = createRouter({
|
||||
routes,
|
||||
});
|
||||
|
||||
router.beforeEach((to) => {
|
||||
router.beforeEach((to, _from, next) => {
|
||||
const heartbeat = storeHeartbeat();
|
||||
if (to.name == "setup" && !heartbeat.value.SHOW_SETUP_WIZARD) {
|
||||
router.push({ name: "dashboard" });
|
||||
next({ name: "dashboard" });
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
// TODO: check permission for views. Ex: view user can access to /scan view
|
||||
});
|
||||
|
||||
router.afterEach(() => {
|
||||
|
||||
@@ -226,7 +226,7 @@ onMounted(async () => {
|
||||
onBeforeRouteUpdate(async (to, from) => {
|
||||
// Triggers when change param of the same route
|
||||
// Reset store if switching to another collection
|
||||
if (to.path === from.path) return;
|
||||
if (to.path === from.path) return true;
|
||||
|
||||
resetGallery();
|
||||
|
||||
@@ -241,6 +241,8 @@ onBeforeRouteUpdate(async (to, from) => {
|
||||
|
||||
await fetchRoms();
|
||||
setFilters();
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
@@ -227,7 +227,7 @@ onMounted(async () => {
|
||||
onBeforeRouteUpdate(async (to, from) => {
|
||||
// Triggers when change param of the same route
|
||||
// Reset store if switching to another platform
|
||||
if (to.path === from.path) return;
|
||||
if (to.path === from.path) return true;
|
||||
|
||||
resetGallery();
|
||||
|
||||
@@ -242,6 +242,8 @@ onBeforeRouteUpdate(async (to, from) => {
|
||||
|
||||
await fetchRoms();
|
||||
setFilters();
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
@@ -84,6 +84,7 @@ onBeforeMount(async () => {
|
||||
|
||||
onBeforeRouteLeave(() => {
|
||||
currentRom.value = null;
|
||||
return true;
|
||||
});
|
||||
|
||||
watch(
|
||||
|
||||
Reference in New Issue
Block a user