'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.initialState = undefined;
exports.default = progressReducer;
var _progress = require('../actions/progress');
var Actions = _interopRequireWildcard(_progress);
function _interopRequireWildcard(obj) { Eif (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
var initialState = exports.initialState = {
current: 0,
total: null,
progressReset: false
};
function progressReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
var action = arguments[1];
switch (action.type) {
case Actions.SETUP_PROGRESS:
{
return { current: 0, total: action.total };
}
case Actions.ON_SOME_PROGRESS:
{
return Object.assign({}, state, { current: action.current });
}
case Actions.RESET_PROGRESS:
{
return { current: 0, total: null, progressReset: action.val };
}
default:
return state;
}
}
|