mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-12-26 06:40:17 +08:00
refactor(projects): 精简版+动态路由权限初步
This commit is contained in:
10
src/service/middleware/auth.ts
Normal file
10
src/service/middleware/auth.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
import { transformAuthRouteToVueRoute } from '@/utils';
|
||||
|
||||
export function userRoutesMiddleware(data: ApiRoute.ResponseRoute | null) {
|
||||
if (!data) return [];
|
||||
|
||||
const routes: RouteRecordRaw[] = data.routes.map(item => transformAuthRouteToVueRoute(item));
|
||||
|
||||
return routes;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import type { ResponseDictionary, Dictionary } from '@/interface';
|
||||
|
||||
export function fecthDictionaryMiddleware(data: ResponseDictionary[]): Dictionary[] {
|
||||
return data.map(item => {
|
||||
const {
|
||||
modelName: label,
|
||||
modelCharactorName: charactorLabel,
|
||||
modelIndicator: indicatorKey,
|
||||
modelIndicatorName: indicatorLabel,
|
||||
remarks: remark,
|
||||
formula
|
||||
} = item;
|
||||
|
||||
return {
|
||||
label,
|
||||
charactorLabel,
|
||||
indicatorKey,
|
||||
indicatorLabel,
|
||||
remark,
|
||||
formula
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
export * from './demo';
|
||||
export * from './auth';
|
||||
|
||||
Reference in New Issue
Block a user