@magnetarjs/plugin-simple-store
Version:
Magnetar plugin simple store
14 lines (13 loc) • 587 B
JavaScript
export function revertActionFactory(data, simpleStoreOptions, 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-simple-store] revert not yet implemented for ${actionName}`);
};
}