lml-main
Version:
This is now a mono repository published into many standalone packages.
25 lines • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const actions_1 = require("../../jobs/actions");
const selectors_1 = require("../../mapping/selectors");
const actions_2 = require("../../mapping/actions");
exports.hideJobDirections = (action$, store) => action$.ofType(actions_1.UNSET_ACTIVE_JOB, actions_1.HIDE_JOB_DIRECTIONS)
.map((action) => actions_2.hideDirections(action.refId));
/**
* If a new job has been made active and the
* directions for a previous job are showing
* then we should remove the previous directions
*
* @param action$
* @param store
*/
exports.hideDirectionsWhenActiveJobChanged = (action$, store) => action$.ofType(actions_1.SET_ACTIVE_JOB)
.filter((action) => {
const directions = selectors_1.getMapDirections(store.getState());
return directions && directions.id !== action.refId;
})
.map((action) => {
const directions = selectors_1.getMapDirections(store.getState());
return actions_2.hideDirections(directions.id);
});
//# sourceMappingURL=hide-directions.js.map