Skip to content

Commit ccd5564

Browse files
deepanchalBradenM
authored andcommitted
feat(router)!: disable all routes and redirect all pages to site maintenance page
1 parent 9854b03 commit ccd5564

File tree

1 file changed

+30
-25
lines changed

1 file changed

+30
-25
lines changed

src/router.js

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -208,33 +208,38 @@ router.beforeEach((to, from, next) => {
208208
},
209209
});
210210

211-
if (to.matched.some((record) => record.meta.noAuth)) {
211+
if (to.name === 'nav.site_maintenance') {
212212
next();
213-
} else if (to.matched.some((record) => record.meta.admin)) {
214-
if (!store.getters['auth/isAdmin']) {
215-
next({ name: 'nav.dashboard' });
216-
return;
217-
}
218-
next();
219-
} else {
220-
if (store.getters['auth/isLoggedIn']) {
221-
// Orphaned Users can't really login this will navigate to a public landing page once it is built
222-
if (store.getters['auth/isOrphan']) {
223-
next({ name: 'nav.request_access', query: { orphan: true } });
224-
return;
225-
}
226-
if (to.matched.some((record) => record.meta.banner)) {
227-
const record = to.matched.find((r) => r.meta.banner);
228-
store.commit(`ui/${UITypes.SET_BANNER}`, record.meta.banner);
229-
} else {
230-
store.commit(`ui/${UITypes.SET_BANNER}`, { enabled: false });
231-
}
232-
next();
233-
return;
234-
}
235-
const loginpath = window.location.pathname;
236-
next({ name: 'nav.login', query: { from: loginpath } });
237213
}
214+
next({ name: 'nav.site_maintenance' });
215+
216+
// if (to.matched.some((record) => record.meta.noAuth)) {
217+
// next();
218+
// } else if (to.matched.some((record) => record.meta.admin)) {
219+
// if (!store.getters['auth/isAdmin']) {
220+
// next({ name: 'nav.dashboard' });
221+
// return;
222+
// }
223+
// next();
224+
// } else {
225+
// if (store.getters['auth/isLoggedIn']) {
226+
// // Orphaned Users can't really login this will navigate to a public landing page once it is built
227+
// if (store.getters['auth/isOrphan']) {
228+
// next({ name: 'nav.request_access', query: { orphan: true } });
229+
// return;
230+
// }
231+
// if (to.matched.some((record) => record.meta.banner)) {
232+
// const record = to.matched.find((r) => r.meta.banner);
233+
// store.commit(`ui/${UITypes.SET_BANNER}`, record.meta.banner);
234+
// } else {
235+
// store.commit(`ui/${UITypes.SET_BANNER}`, { enabled: false });
236+
// }
237+
// next();
238+
// return;
239+
// }
240+
// const loginpath = window.location.pathname;
241+
// next({ name: 'nav.login', query: { from: loginpath } });
242+
// }
238243
});
239244

240245
function patchRouterMethod(r, methodName) {

0 commit comments

Comments
 (0)