金融产品设计及数字化营销沙盘
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
841 B

1 year ago
import NProgress from 'nprogress'; // progress bar
import 'nprogress/nprogress.css'; // progress bar style
import { RouteLocationNormalized } from 'vue-router';
import getPageTitle from '@/utils/getPageTitle';
import { getAccessToken } from '@/utils/auth'; // get token from cookie
import router from './router';
NProgress.configure({ showSpinner: false }); // NProgress Configuration
const LOGIN_PATH = '/login';
router.beforeEach(async (to: RouteLocationNormalized) => {
NProgress.start();
1 year ago
return true;
});
router.afterEach((to: RouteLocationNormalized) => {
// set page title
document.title = getPageTitle(to.meta.title);
// finish progress bar
NProgress.done();
});
1 year ago
router.onError((error, to) => {
if (error.message.includes('Failed to fetch dynamically imported module')) {
window.location = to.fullPath;
}
});