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 api = useContext(APIClientContext);
let tempOptions,tempService
let tempOptions, tempService;
if (typeof service === 'function') {
tempService = service
}else {
tempService = service;
} else {
tempService = async (params = {}) => {
const { resource } = service as ResourceActionOptions;
let args = cloneDeep(service);
@ -41,21 +41,21 @@ export function useRequest<P>(
}
const response = await api.request(args);
return response?.data;
}
};
}
tempOptions = {
...options,
onSuccess(...args) {
// @ts-ignore
options.onSuccess?.(...args)
options.onSuccess?.(...args);
if (options.uid) {
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],
pageSize: 200,
page: 1,
...field.componentProps?.params
...field.componentProps?.params,
},
},
{
@ -919,9 +919,9 @@ export const useAssociationFilterBlockProps = () => {
useEffect(() => {
// 由于 选项字段不需要触发当前请求,所以请求单独在 关系字段的时候触发
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)) {
const field = optionalFieldList.find((field) => field.name === fieldSchema.name);