Replace NoFound view by a generic error view

This commit is contained in:
Bubka 2020-01-10 10:25:29 +01:00
parent e9ecbbe057
commit dda3901bb9
4 changed files with 33 additions and 6 deletions

9
resources/js/app.js vendored
View File

@ -9,7 +9,7 @@ import Register from './views/Register'
import Accounts from './views/Accounts' import Accounts from './views/Accounts'
import Create from './views/Create' import Create from './views/Create'
import Edit from './views/Edit' import Edit from './views/Edit'
import NotFound from './views/NotFound' import NotFound from './views/Error'
import { library } from '@fortawesome/fontawesome-svg-core' import { library } from '@fortawesome/fontawesome-svg-core'
import { faPlus, faQrcode, faImage, faTrash, faEdit, faCheck, faLock, faLockOpen } from '@fortawesome/free-solid-svg-icons' import { faPlus, faQrcode, faImage, faTrash, faEdit, faCheck, faLock, faLockOpen } from '@fortawesome/free-solid-svg-icons'
@ -51,7 +51,12 @@ const router = new VueRouter({
{ {
path: '/404', path: '/404',
name: '404', name: '404',
component: NotFound, component: NotFound
},
{
path: '/error',
name: 'GenericError',
component: NotFound
}, },
], ],
}); });

View File

@ -87,7 +87,7 @@
}) })
.catch(error => { .catch(error => {
if (error.response.status === 404) { if (error.response.status === 404) {
this.$router.push({name: '404' }); this.$router.push({ name: '404' });
} }
}); });
}, },
@ -120,7 +120,7 @@
this.errors = error.response.data.error this.errors = error.response.data.error
} }
else if (error.response.status === 404) { else if (error.response.status === 404) {
this.$router.push({name: '404' }); this.$router.push({ name: '404' });
} }
}); });
}, },

View File

@ -1,8 +1,13 @@
<template> <template>
<div> <div>
<modal v-model="ShowModal"> <modal v-model="ShowModal">
<div> <div v-if="$route.name == '404'">
Resource not found, please <router-link :to="{ name: 'accounts' }" class="is-text has-text-white">refresh</router-link> <p class="error-404"></p>
<p>Resource not found, please <router-link :to="{ name: 'accounts' }" class="is-text has-text-white">refresh</router-link></p>
</div>
<div v-else>
<p class="error-generic"></p>
<p>An error occured, please <router-link :to="{ name: 'accounts' }" class="is-text has-text-white">refresh</router-link></p>
</div> </div>
</modal> </modal>
</div> </div>

File diff suppressed because one or more lines are too long