@fabric-es/fabric-cqrs
Version:
Hyperledger Fabric middleware for event sourcing and cqrs pattern
22 lines • 810 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getErrorActionHandler = exports.getSuccessActionHandler = void 0;
const assign_1 = __importDefault(require("lodash/assign"));
const getSuccessActionHandler = (type) => (state, { payload: { tx_id, result } }) => ({
tx_id,
type,
result,
error: null,
});
exports.getSuccessActionHandler = getSuccessActionHandler;
const getErrorActionHandler = (type) => (state, { payload: { tx_id, error } }) => assign_1.default({}, {
tx_id,
type,
result: null,
error,
});
exports.getErrorActionHandler = getErrorActionHandler;
//# sourceMappingURL=getActionHandlers.js.map