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

Replace router push with the one that catches errors

parent 8c9b5d59
No related branches found
No related tags found
1 merge request!195Move Settings tab navigation to the main sidebar menu
Pipeline #34738 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