feat: add cURL import for http request node (#8656)
This commit is contained in:
@@ -164,6 +164,23 @@ const useConfig = (id: string, payload: HttpNodeType) => {
|
||||
setRunInputData(newPayload)
|
||||
}, [setRunInputData])
|
||||
|
||||
// curl import panel
|
||||
const [isShowCurlPanel, {
|
||||
setTrue: showCurlPanel,
|
||||
setFalse: hideCurlPanel,
|
||||
}] = useBoolean(false)
|
||||
|
||||
const handleCurlImport = useCallback((newNode: HttpNodeType) => {
|
||||
const newInputs = produce(inputs, (draft: HttpNodeType) => {
|
||||
draft.method = newNode.method
|
||||
draft.url = newNode.url
|
||||
draft.headers = newNode.headers
|
||||
draft.params = newNode.params
|
||||
draft.body = newNode.body
|
||||
})
|
||||
setInputs(newInputs)
|
||||
}, [inputs, setInputs])
|
||||
|
||||
return {
|
||||
readOnly,
|
||||
isDataReady,
|
||||
@@ -203,6 +220,11 @@ const useConfig = (id: string, payload: HttpNodeType) => {
|
||||
inputVarValues,
|
||||
setInputVarValues,
|
||||
runResult,
|
||||
// curl import
|
||||
isShowCurlPanel,
|
||||
showCurlPanel,
|
||||
hideCurlPanel,
|
||||
handleCurlImport,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user