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,7 @@
import type { Component } from 'vue';
import { EnumRoutePath } from '@/enum';
import type { RoutePathKey } from '@/interface';
import { router } from '@/router';
/** 获取路由name map */
export function getRouteNameMap() {
@ -13,3 +14,9 @@ export function setRouterCacheName(component: Component, name?: string) {
Object.assign(component, { name });
}
}
export function getLoginRedirectUrl() {
const path = router.currentRoute.value.fullPath as EnumRoutePath;
const redirectUrl = path === EnumRoutePath.root ? undefined : path;
return redirectUrl;
}