Skip to content

Commit

Permalink
Rewrite VueRouter.prototype.push (fixed #252) (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-lee90 committed Jun 21, 2020
1 parent 1fa1524 commit 014805a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/router/AppRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/
// external dependencies
import Router from 'vue-router'
import Router, { RawLocation } from 'vue-router'
// internal dependencies
import { routes } from '@/router/routes'
import { AppRoute } from './AppRoute'
Expand All @@ -36,6 +36,12 @@ export class AppRouter extends Router {
constructor(options) {
super(options)
this.routes = options.routes
const originalPush = this.push
this.push = (location: RawLocation) => {
return originalPush.call(this, location).catch(() => {
/* eslint */
})
}
this.beforeEach((to, from, next) => {
const service = new ProfileService()
const hasAccounts = service.getProfiles().length > 0
Expand Down

0 comments on commit 014805a

Please sign in to comment.