feat: update test email sender mutation to include inputs and adjust API endpoint for better data handling

This commit is contained in:
twwu 2026-01-16 17:52:33 +08:00
parent 3bf8f19874
commit d401a29bd9
2 changed files with 11 additions and 2 deletions

View File

@ -141,13 +141,14 @@ const EmailSenderModal = ({
appID: appDetail?.id || '',
nodeID: nodeId,
deliveryID: deliveryId,
inputs,
})
setDone(true)
}
finally {
setSendingEmail(false)
}
}, [appDetail, nodeId, deliveryId, testEmailSender])
}, [testEmailSender, appDetail?.id, nodeId, deliveryId, inputs])
if (done) {
return (

View File

@ -231,6 +231,14 @@ export const useEditInspectorVar = (flowType: FlowType, flowId: string) => {
export const useTestEmailSender = () => {
return useMutation({
mutationKey: [NAME_SPACE, 'test email sender'],
mutationFn: async (data: { appID: string, nodeID: string, deliveryID: string }) => post<CommonResponse>(`apps/${data.appID}/human-input/test-delivery/${data.nodeID}/${data.deliveryID}`),
mutationFn: async (data: { appID: string, nodeID: string, deliveryID: string, inputs: Record<string, any> }) => {
const { appID, nodeID, deliveryID, inputs } = data
return post<CommonResponse>(`/apps/${appID}/workflows/draft/human-input/nodes/${nodeID}/delivery-test`, {
body: {
delivery_method_id: deliveryID,
inputs,
},
})
},
})
}