Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
router.afterEach((routeTo, routeFrom) => {
// Complete the animation of the route progress bar.
NProgress.done()
})
route.meta.beforeResolve(routeTo, routeFrom, (...args) => {
// If the user chose to redirect...
if (args.length) {
// If redirecting to the same route we're coming from...
if (routeFrom.name === args[0].name) {
// Complete the animation of the route progress bar.
NProgress.done()
}
// Complete the redirect.
next(...args)
reject(new Error('Redirected'))
} else {
resolve()
}
})
} else {
router.afterEach((routeTo, routeFrom) => {
// Complete the animation of the route progress bar.
NProgress.done()
})
.then((response) => {
NProgress.done();
afterTime = new Date();
return response.json()
}).then((data) => {
data.elapsedTime = afterTime.getTime() - beforeTime.getTime();