mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-09 05:54:34 +02:00
Set up a global notification handler & Error view & Modal component
This commit is contained in:
7
resources/js_vue3/router/index.js
vendored
7
resources/js_vue3/router/index.js
vendored
@ -25,10 +25,11 @@ import SettingsOptions from '../views/settings/Options.vue'
|
||||
// import SettingsWebAuthn from './views/settings/WebAuthn.vue'
|
||||
// import EditCredential from './views/settings/Credentials/Edit.vue'
|
||||
// import GeneratePAT from './views/settings/PATokens/Create.vue'
|
||||
// import Errors from './views/Error.vue'
|
||||
import Errors from '../views/Error.vue'
|
||||
import About from '../views/About.vue'
|
||||
|
||||
import authGuard from './middlewares/authGuard'
|
||||
import noEmptyError from './middlewares/noEmptyError'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory('/'),
|
||||
@ -61,8 +62,8 @@ const router = createRouter({
|
||||
{ path: '/webauthn/lost', name: 'webauthn.lost', component: WebauthnLost, meta: { disabledWithAuthProxy: true, showAbout: true } },
|
||||
// { path: '/webauthn/recover', name: 'webauthn.recover', component: WebauthnRecover, meta: { disabledWithAuthProxy: true, showAbout: true } },
|
||||
|
||||
{ path: '/about', name: 'about',component: About, meta: { showAbout: true } },
|
||||
// { path: '/error', name: 'genericError',component: Errors, props: true },
|
||||
{ path: '/about', name: 'about', component: About, meta: { showAbout: true } },
|
||||
{ path: '/error', name: 'genericError', component: Errors, meta: { middlewares: [noEmptyError], err: null } },
|
||||
// { path: '/404', name: '404',component: Errors, props: true },
|
||||
// { path: '*', redirect: { name: '404' } },
|
||||
|
||||
|
8
resources/js_vue3/router/middlewares/noEmptyError.js
vendored
Normal file
8
resources/js_vue3/router/middlewares/noEmptyError.js
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
export default function noEmptyError({ to, next }) {
|
||||
next()
|
||||
if (to.params.err == undefined) {
|
||||
// return to home if no err object is provided to prevent an empty error message
|
||||
next({ name: 'accounts' });
|
||||
}
|
||||
else next()
|
||||
}
|
Reference in New Issue
Block a user