I created a delete button, which allows the user to delete a line.
The problem is that after the deletion, the user does not get any confirm that the deletion was performed.
I tried to use "after remove" webhook that looked like this -
------
import wixLocation from 'wix-location'
export function PositionsManagement_afterRemove(item, context) {
//TODO: write your code here...
console.log('PositionsManagement_afterRemove');
wixLocation.to('/thank-you-page');
}
----
But still nothing happens and until you refresh the page you can not see that the row has been deleted.
Thanks
Hadar
Hi Hadar,
I am wondering how to create a Delete Button, could you please share how you did yours?
Hi Gilbert,
Witch error does it throw ?
This is probably due to permission misconfiguration.
See more about permissions here.
Roi
Hi there, it seems that this code throws an error in a dynamic page and don't perform the remove. Any idea why it happens?
Thanks,
Gilbert
Hay Hadar,
The after remove event is a backend hook, and as such cannot be used to show a user a confirmation message or to navigate to another page.
What you can do is to, instead of connecting a button to the delete action of the dataset, write a little code, use the remove API of the dataset and wait on the delete function promise resolution to do something.
It will look something like the following -
export function BUTTON1_onClick(event) { $w('#DATASET1').remove() .then(() => { wixLocation.to('/thank-you-page'); }) }