const onCellClick = p => {
const policyId = p?.id;
const updatedBy = p?.row?.updated_by;
console.log(updatedBy, "updatedBy");
applyPolicies(policyId, updatedBy);
};
字符串
这是我使用pID和updatedBy进行API调用的另一个函数,在pID正常的情况下,updatedBy变为未定义。
export const useApplyPolicyMutation = () => {
return useMutation(
(pID, updatedBy) => {
console.log(updatedBy, "updatedByinquery");
console.log(pID, "pID");
const workspaceId = getWS();
const payload = {
workspace_id: workspaceId,
policy_id: pID,
updated_by: updatedBy
};
customPost("/policymanagement/api/v1/auto-discover/add-policy", payload);
}
1条答案
按热度按时间mum43rcc1#
useMutation
只能接受一个参数作为有效负载,因此需要将其 Package 在一个对象中: