| 29 | }) |
| 30 | |
| 31 | const fetchList = async ({ name, nodeData, previousNodes, currentNode }) => { |
| 32 | const selectedParam = nodeData.inputParams.find((param) => param.name === name) |
| 33 | const loadMethod = selectedParam?.loadMethod |
| 34 | |
| 35 | let credentialId = nodeData.credential |
| 36 | if (!credentialId && (nodeData.inputs?.credential || nodeData.inputs?.['FLOWISE_CREDENTIAL_ID'])) { |
| 37 | credentialId = nodeData.inputs.credential || nodeData.inputs?.['FLOWISE_CREDENTIAL_ID'] |
| 38 | } |
| 39 | |
| 40 | let config = { |
| 41 | headers: { |
| 42 | 'x-request-from': 'internal', |
| 43 | 'Content-type': 'application/json' |
| 44 | }, |
| 45 | withCredentials: true |
| 46 | } |
| 47 | |
| 48 | let lists = await axios |
| 49 | .post( |
| 50 | `${baseURL}/api/v1/node-load-method/${nodeData.name}`, |
| 51 | { ...nodeData, loadMethod, previousNodes, currentNode, credential: credentialId }, |
| 52 | config |
| 53 | ) |
| 54 | .then(async function (response) { |
| 55 | return response.data |
| 56 | }) |
| 57 | .catch(function (error) { |
| 58 | console.error(error) |
| 59 | }) |
| 60 | return lists |
| 61 | } |
| 62 | |
| 63 | export const AsyncDropdown = ({ |
| 64 | name, |