lml-main
Version:
This is now a mono repository published into many standalone packages.
23 lines • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const redux_observable_1 = require("redux-observable");
const cosmoui_1 = require("cosmoui");
const actions_1 = require("../actions");
const cosmo_redux_api_1 = require("@lml/cosmo-redux-api");
const constants_1 = require("../constants");
exports.putPlaceSuccess = (action$, store) => action$.ofType(cosmo_redux_api_1.POST_PLACE.SUCCESS, cosmo_redux_api_1.PUT_PLACE.SUCCESS)
.mergeMap(action => {
const msg = action.type === cosmo_redux_api_1.POST_PLACE.SUCCESS ? 'created' : 'updated';
return [
actions_1.closePlaceFormDrawer(),
cosmoui_1.destroyForm(constants_1.PLACE_FORM_KEY),
cosmoui_1.notificationSuccess(`Place was successfully ${msg}`),
];
});
exports.putPlaceError = (action$, store) => action$.ofType(cosmo_redux_api_1.POST_PLACE.ERROR, cosmo_redux_api_1.PUT_PLACE.ERROR)
.map(action => {
const msg = action.type === cosmo_redux_api_1.POST_PLACE.ERROR ? 'creating' : 'updating';
return cosmoui_1.notificationError(`There was a problem ${msg} the place. Please try again`);
});
exports.puttPlaceEpics = redux_observable_1.combineEpics(exports.putPlaceSuccess, exports.putPlaceError);
//# sourceMappingURL=put-place.js.map