refactor(projects): 登录重定向地址相关重构

This commit is contained in:
Soybean
2021-10-18 18:01:14 +08:00
parent 336c7766f9
commit 04008b63ee
11 changed files with 52 additions and 52 deletions

View File

@ -1,6 +1,6 @@
import type { Router, RouteLocationNormalized, NavigationGuardNext } from 'vue-router';
import { useTitle } from '@vueuse/core';
import { getToken } from '@/utils';
import { getToken, getLoginRedirectUrl } from '@/utils';
import { RouteNameMap } from '../helpers';
/**
@ -46,7 +46,7 @@ function handleRouterAction(to: RouteLocationNormalized, from: RouteLocationNorm
[
!isLogin && needLogin,
() => {
const redirectUrl = window.location.href;
const redirectUrl = getLoginRedirectUrl();
next({ name: RouteNameMap.get('login'), query: { redirectUrl } });
}
],