[Vuejs]-How do you add a confirmation before an action in Pinia?

1👍

So long story short I’ve done it by creating a few utility functions that will wrap the pinia store actions.

const setCurrentItemWithConfirm = (status) => {
    if (!confirm(t('alerts.confirm_dirty_collection'))) { return; }

    return store.setCurrentItem(status);
}

I’ve followed the guides to move Pinia & i18n outside components and things looks good:

So… yay?

Leave a comment