Having info in a member only view repeater delete on click.

I have the following code which works on preview:

export function deleteButton_click(event) {
//Add your code for this event here:
let item = $w(“#dataset3”).getCurrentItem();
wixData.remove(“savedAddresses”, item._id);
setTimeout (() => {
$w(‘#dataset3’).refresh();
}, 200)
}

The button is inside the repeater box that should have the info deleted. It only doesn’t work on live site for some reason.

Any help would be awesome!

Thanks!!!

So, it doesn’t work on live site? You may want to check your database permissions (who can delete, edit, etc the database).

Also, why can’t you just connect the button to the delete action? I think that should work without coding everything. Having everything aside from the button to be ready-only. Make the database read & write.

2 Likes

Issue was with permissions. Had who can delete as Admin only instead of site member.

Thank you!!!

on a separate issue if you have time,

when a user is logged in on my site, I redirect them to their profile page; however, it seems that whenever they switch pages they automatically get logged out and need to log back in. Any way to fix this?

thank you in advance!

@anneynorton7 Interesting. I am not sure about that. What is the purpose for redirecting them to the profile page? Maybe there’s a workaround.

1 Like

@brettfranklin2 Actually solved the problem haha.

The full issue was that I had a profile button that you would click on to make a get a user to their login page/profile (if logged in) I wrote the code for that, but it kept going to the login page even if the user was already logged in and wanted me to re-login. Turns out I forgot to unlink the image from that login page (it had been linked for testing a while back).

1 Like