chore: fix lint errors

This commit is contained in:
Rairn 2023-04-27 15:22:17 +08:00
parent 7ddc5fb33c
commit 23ad507261
2 changed files with 11 additions and 11 deletions

View File

@ -25,11 +25,11 @@ export function useRequest<P>(
const [state, setState] = useSetState({}); const [state, setState] = useSetState({});
const api = useContext(APIClientContext); const api = useContext(APIClientContext);
let tempOptions,tempService let tempOptions, tempService;
if (typeof service === 'function') { if (typeof service === 'function') {
tempService = service tempService = service;
}else { } else {
tempService = async (params = {}) => { tempService = async (params = {}) => {
const { resource } = service as ResourceActionOptions; const { resource } = service as ResourceActionOptions;
let args = cloneDeep(service); let args = cloneDeep(service);
@ -41,21 +41,21 @@ export function useRequest<P>(
} }
const response = await api.request(args); const response = await api.request(args);
return response?.data; return response?.data;
} };
} }
tempOptions = { tempOptions = {
...options, ...options,
onSuccess(...args) { onSuccess(...args) {
// @ts-ignore // @ts-ignore
options.onSuccess?.(...args) options.onSuccess?.(...args);
if (options.uid) { if (options.uid) {
api.services[options.uid] = result; api.services[options.uid] = result;
} }
}, },
} };
const result:any = useReq(tempService, tempOptions) const result: any = useReq(tempService, tempOptions);
return { ...result, state, setState } return { ...result, state, setState };
} }

View File

@ -906,7 +906,7 @@ export const useAssociationFilterBlockProps = () => {
fields: [labelKey, valueKey], fields: [labelKey, valueKey],
pageSize: 200, pageSize: 200,
page: 1, page: 1,
...field.componentProps?.params ...field.componentProps?.params,
}, },
}, },
{ {
@ -919,9 +919,9 @@ export const useAssociationFilterBlockProps = () => {
useEffect(() => { useEffect(() => {
// 由于 选项字段不需要触发当前请求,所以请求单独在 关系字段的时候触发 // 由于 选项字段不需要触发当前请求,所以请求单独在 关系字段的时候触发
if (!isOptionalField(fieldSchema)) { if (!isOptionalField(fieldSchema)) {
run() run();
} }
},[labelKey, valueKey, JSON.stringify(field.componentProps?.params || {}), isOptionalField(fieldSchema)]) }, [labelKey, valueKey, JSON.stringify(field.componentProps?.params || {}), isOptionalField(fieldSchema)]);
if (isOptionalField(fieldSchema)) { if (isOptionalField(fieldSchema)) {
const field = optionalFieldList.find((field) => field.name === fieldSchema.name); const field = optionalFieldList.find((field) => field.name === fieldSchema.name);