I have 2 functions and I want to send values back and forth to each other.
const higher_fnc = (query_name) => {
return axios({
url: GraphQL_Endpoint,
method: "post",
headers: headers,
data: query_name,
});
};
const func1 = (arg1, arg2) => {
higher_fnc({
query: query1,
variables: {
id: arg1
},
}).then((d) => {
for (const x of d.data) {
const arr = [];
for (const node of x.nodes) {
const myObj = {};
if (node.id === "56789") {
func2(node.internalID);
arr.push(arg2);
}
}
}
});
});
}
const func2 = (val) => {
higher_fnc({
query: query1,
variables: {
id: val
},
}).then((d) => func1("", d.main));
}
Basically, I need func1
to send a value to func2
and then I need func2
to send back values to func1
.
Right now my code is just sending empty strings.