feat: list interface supports POST method

This commit is contained in:
Zeke Zhang 2025-04-15 07:24:15 +08:00
parent ba83b2b1be
commit b02e61725f
3 changed files with 11 additions and 3 deletions

View File

@ -18,7 +18,8 @@ function totalPage(total, pageSize): number {
function findArgs(ctx: Context) {
const params = ctx.action.params;
const { fields, filter, appends, except, sort } = params;
const { values = {}, others } = params;
const { fields, filter, appends, except, sort } = { ...others, ...values };
let { tree } = params;
if (tree === true || tree === 'true') {
tree = true;

View File

@ -57,8 +57,15 @@ function useRecordRequest<T>(options: Omit<AllDataBlockProps, 'type'>) {
}
const paramsValue = params.filterByTk === undefined ? _.omit(params, 'filterByTk') : params;
let mergedParams = { ...paramsValue, ...customParams };
return resource[action]?.({ ...paramsValue, ...customParams }).then((res) => res.data);
if (action === 'list') {
mergedParams = {
values: mergedParams,
};
}
return resource[action]?.(mergedParams).then((res) => res.data);
};
const service = async (...arg) => {

View File

@ -378,7 +378,7 @@ export class APIClient {
let url = name.split('.').join(`/${encodeURIComponent(of) || '_'}/`);
url += `:${actionName.toString()}`;
const config: AxiosRequestConfig = { url };
if (['get', 'list'].includes(actionName)) {
if (['get'].includes(actionName)) {
config['method'] = 'get';
} else {
config['method'] = 'post';