'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = update;

var _dictActions = require('../constant/dictActions');

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } /**
                                                                                                                                                                                                     * Created by baoyinghai on 10/20/16.
                                                                                                                                                                                                     */


var initialState = [];

function update() {
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
  var action = arguments[1];

  switch (action.type) {
    case _dictActions.MENU_RESET:
      return [].concat(_toConsumableArray(action.payload));
    case _dictActions.INIT_DATA_FROM_SERVER:
      {
        return [].concat(_toConsumableArray(action.payload.menu));
      }
    case _dictActions.AUTH_FORCE_LOGOUT:
      return [];
    default:
      return state;
  }
}