mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
feat: list interface supports POST method
This commit is contained in:
parent
ba83b2b1be
commit
b02e61725f
@ -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;
|
||||
|
@ -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) => {
|
||||
|
@ -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';
|
||||
|
Loading…
x
Reference in New Issue
Block a user