我有两个相互调用的函数。如何在满足所有条件时发送消息?
我的代码:
const func1 = async (arg) => {
let table_id = result.data.internal_id;
const response = await axios_Func({ graphQL query });
console.log(`${response.data.name} - ${table_id}`);
return func2({ query: graphQL_query, table_id });
}
func2 = async (result, table_id) => {
let dev = await getAllTables({ query: tables(123) });
let prod = await getAllTables({ query: tables(321) });
let prod_id = new Set();
result.data.data.table.table_fields.forEach((d) => {
if (d. connector != null && !(d.name in dev))
prod_id.add(prod[d.name]["id"]);
});
prod_id = [...prod_id];
prod_id.map((x) => createOne({ query: graphQL_query(x) });
});
const callback = () => console.log("all done");
现在我的函数返回:
xyz - M5WBmnWs
abc - QrqJ91Rq
qwe - VP0B0KEt
我怎么打电话给
callback
?让我的输出看起来像这样:
xyz - M5WBmnWs
abc - QrqJ91Rq
qwe - VP0B0KEt
all done