mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): 登录重定向地址相关重构
This commit is contained in:
@ -1,2 +1 @@
|
||||
export { getToken, setToken, removeToken, getUserInfo, resetAuthStorage, getLoginModuleRegExp } from './user';
|
||||
export { getLoginRedirectUrl, toLoginRedirectUrl } from './location';
|
||||
|
@ -1,9 +0,0 @@
|
||||
/** 获取登录重定向的地址 */
|
||||
export function getLoginRedirectUrl() {
|
||||
return window.location.href;
|
||||
}
|
||||
|
||||
/** 登录后跳转重定向的地址 */
|
||||
export function toLoginRedirectUrl(redirectUrl: string) {
|
||||
window.location.href = redirectUrl;
|
||||
}
|
@ -1,13 +1,4 @@
|
||||
export {
|
||||
setToken,
|
||||
getToken,
|
||||
removeToken,
|
||||
getUserInfo,
|
||||
resetAuthStorage,
|
||||
getLoginModuleRegExp,
|
||||
getLoginRedirectUrl,
|
||||
toLoginRedirectUrl
|
||||
} from './auth';
|
||||
export { setToken, getToken, removeToken, getUserInfo, resetAuthStorage, getLoginModuleRegExp } from './auth';
|
||||
|
||||
export {
|
||||
isNumber,
|
||||
@ -39,4 +30,4 @@ export {
|
||||
clearSession
|
||||
} from './storage';
|
||||
|
||||
export { getRouteNameMap, setRouterCacheName } from './router';
|
||||
export { getRouteNameMap, setRouterCacheName, getLoginRedirectUrl } from './router';
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user