mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-10-14 22:03:41 +08:00
28 lines
823 B
TypeScript
28 lines
823 B
TypeScript
import type { ResponseDictionary, Dictionary } from '@/interface';
|
|
import { request, resultMiddleware } from '../request';
|
|
import { fecthDictionaryMiddleware } from '../middleware';
|
|
|
|
// 接口示例
|
|
|
|
/**
|
|
* 获取数据字典(不加middleware处理)
|
|
* @param keyword - 关键词
|
|
*/
|
|
export function fetchDictionary(keyword: string) {
|
|
return request.post<ResponseDictionary[]>('/emoss-entropy/ehe/model/getByIndicator', {
|
|
indiCatorName: keyword
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 获取数据字典(加middleware处理)
|
|
* @param keyword - 关键词
|
|
*/
|
|
export async function fetchDictionaryWithMiddleware(keyword: string) {
|
|
const res = await request.post<ResponseDictionary[]>('/emoss-entropy/ehe/model/getByIndicator', {
|
|
indiCatorName: keyword
|
|
});
|
|
|
|
return resultMiddleware<Dictionary[]>(fecthDictionaryMiddleware, [res]);
|
|
}
|