new Button({
appendTo : targetElement,
text : 'confirm()',
onClick : async() => {
const result = await MessageDialog.confirm({
title : 'The big question',
message : 'Do one legged ducks swim in circles?',
okButton : 'Yes',
cancelButton : 'No'
});
Toast.show(`You answered ${result === MessageDialog.okButton ? 'Yes' : 'No'}`);
}
});
Re: [REACT] -Typescript: on confirmation dialogue ok click need to hit API
Posted: Mon May 29, 2023 6:15 pm
by swapnakonakanchi
Hi Alex,
What you provided that dialogue is fine. I want to call API with parameter. On 'Yes' click. Please suggest.
Re: [REACT] -Typescript: on confirmation dialogue ok click need to hit API
Posted: Mon May 29, 2023 6:24 pm
by marcio
Hey,
You can use the following approach to call an API with the parameter on YES click
const result = await MessageDialog.confirm({
title : 'The big question',
message : 'Do one legged ducks swim in circles?',
okButton : 'Yes',
cancelButton : 'No'
});
if(result === MessageDialog.okButton) {
// call API with parameter
}
Is that what you're looking for?
Re: [REACT] -Typescript: on confirmation dialogue ok click need to hit API
Posted: Mon May 29, 2023 6:58 pm
by swapnakonakanchi
Yes, But not getting how to call API in that, I tried as below but not working. Please provide sample code.
if (result === MessageDialog.okButton) {
// call API with parameter
transport: {
url: '/Process/ModelTaskDependencies/Sync',
method: 'POST',
params: {
processModelId: null,
}
}
}
Re: [REACT] -Typescript: on confirmation dialogue ok click need to hit API