Skip to content
Snippets Groups Projects
Commit 6722a9e3 authored by Angelina Filippova's avatar Angelina Filippova
Browse files

Replace router push with the one that catches errors

parent 5ca76701
No related branches found
No related tags found
1 merge request!198Fix displaying multiple errors
Pipeline #35291 passed
......@@ -3,6 +3,19 @@ import Router from 'vue-router'
Vue.use(Router)
const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject) { return originalPush.call(this, location, onResolve, onReject) }
return originalPush.call(this, location).catch((err) => {
if (Router.isNavigationFailure(err)) {
// resolve err
return err
}
// rethrow error
return Promise.reject(err)
})
}
/* Layout */
import Layout from '@/views/layout/Layout'
......
......@@ -16,6 +16,7 @@ localVue.use(VueRouter)
localVue.use(Element)
jest.mock('@/api/reports')
jest.mock('@/api/settings')
describe('Log out', () => {
let store
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment