Javascript 如何等待函数完成并使用graphQL调用第二个函数
我有一个表单,它包含应用程序名称和描述,因此描述名称从应用程序名称中获取id,只有在我可以创建描述之后,这里才是UI,正如您所看到的,我还有一个next按钮,因此next按钮将同时创建这两个名称并进入下一页 下面是应用程序名称的第一个Api调用Javascript 如何等待函数完成并使用graphQL调用第二个函数,javascript,reactjs,graphql,Javascript,Reactjs,Graphql,我有一个表单,它包含应用程序名称和描述,因此描述名称从应用程序名称中获取id,只有在我可以创建描述之后,这里才是UI,正如您所看到的,我还有一个next按钮,因此next按钮将同时创建这两个名称并进入下一页 下面是应用程序名称的第一个Api调用 async function handleSubmit(e) { e.preventDefault(); if (!appValue) { return; } updateLoading(true);
async function handleSubmit(e) {
e.preventDefault();
if (!appValue) {
return;
}
updateLoading(true);
await createApp({
variables: {
actionId: CREATE_APP_FOR_APP_SPEC_ACTION_ID,
executionParameters: JSON.stringify({
parentInstanceId: customerId,
value: appValue,
}),
unrestricted: false,
},
refetchQueries,
});
updateAppValue('');
updateLoading(false);
}
这是用于描述的第二个Api
async function handleSubmit(e) {
e.preventDefault();
if (!descriptionValue) {
return;
}
updateLoading(true);
await createDescription({
variables: {
actionId: CREATE_DESCRIPTION_FOR_APP_SPEC_ACTION_ID,
executionParameters: JSON.stringify({
parentInstanceId: parentId,
value: descriptionValue,
}),
unrestricted: false,
},
refetchQueries,
});
updateDescriptionValue('');
updateLoading(false);
}
那是什么?客户使用了什么?如何返回数据。。。在apollo中,我们可以使用
skip
/lazy查询和onCompleted
这一个是使用Appolo CLient@xadmotherly unreadable/unrecognable。。。包括挂钩。。。使用前面提到的选项