ConfirmDialog won't the reject event be triggered when closing things?
Describe the bug
ConfirmDialog won't the reject event be triggered when closing things? What is the best practice to listen to the close event?
Reproducer
https://codesandbox.io/s/nostalgic-https-31pz16?file=/src/ConfirmDialogDemo.vue
PrimeVue version
3.15
Vue version
3.x
Language
ALL
Build / Runtime
Vue CLI App
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
Same issue here. I'd appreciate a "Promise variant" of the ConfirmDialog (and ideally the other dialog options as well). I'm used to work with promises. To my understanding using promises is a more modern JavaScript and produces better code than using callbacks.
In principle one can "promisify" the function on its own, e.g.
async function confDialog() {
return new Promise<boolean>((resolve) => {
confirm.require({
message: 'Are you sure you want to proceed?',
header: 'Confirmation',
icon: 'pi pi-exclamation-triangle',
accept: () => resolve(true),
reject: () => resolve(false),
})
})
}
But if the ConfirmDialog is just closed, there is no way to catch this and call resolve(false). There I fully support this issue!
Fixed via #2938