mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): axios封装完成
This commit is contained in:
@ -1,8 +0,0 @@
|
||||
import { request } from '../request';
|
||||
|
||||
/**
|
||||
* 获取数据字典
|
||||
*/
|
||||
export async function fetchDictionary(keyword: string) {
|
||||
await request.post('/ehe/model/getByIndicator', { indiCatorName: keyword });
|
||||
}
|
||||
|
0
src/service/api/common.ts
Normal file
0
src/service/api/common.ts
Normal file
27
src/service/api/demo.ts
Normal file
27
src/service/api/demo.ts
Normal file
@ -0,0 +1,27 @@
|
||||
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]);
|
||||
}
|
@ -1 +1 @@
|
||||
export * from './auth';
|
||||
export * from './demo';
|
||||
|
Reference in New Issue
Block a user