aboutsummaryrefslogtreecommitdiffstats
path: root/app/javascript/vehicle_journeys/batch.js
blob: ea08572aaceeb97c9a5ea8b94078b5b38e3d2135 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// 'use strict';

// Object.defineProperty(exports, "__esModule", {
// 	value: true
// });
// exports.batchActions = batchActions;
// exports.enableBatching = enableBatching;
// var BATCH = exports.BATCH = 'BATCH';

export function batchActions(actions) {
	return {
    type: 'BATCH',
    payload: actions
  };
}

export function enableBatching(reduce) {
	return function batchingReducer(state, action) {
		switch (action.type) {
			case 'BATCH':
				return action.payload.reduce(batchingReducer, state);
			default:
				return reduce(state, action);
		}
	}
}