@magnetarjs/plugin-vue3
Version: 
Magnetar plugin vue3
14 lines (13 loc) • 577 B
JavaScript
export function revertActionFactory(data, vue3StoreOptions, restoreBackup) {
    return function ({ payload, collectionPath, docId, pluginModuleConfig, actionName, error, }) {
        // revert all write actions when called on a doc
        if (docId) {
            restoreBackup(collectionPath, docId);
            return;
        }
        // insert on collection (no id)
        if (!docId && actionName === 'insert')
            actionName = 'insert on collections';
        console.error(`[@magnetarjs/plugin-vue3] revert not yet implemented for ${actionName}`);
    };
}