'use strict';

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

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _actionTypes = require('../constants/action-types');

var types = _interopRequireWildcard(_actionTypes);

function _interopRequireWildcard(obj) { if (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; } }

function header() {
  var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
  var action = arguments[1];

  switch (action.type) {
    case types.SET_PROGRESS_PRECENTAGE:
      return _extends({}, state, {
        readPercent: action.percent
      });
    case types.SET_PAGE_TYPE:
      return _extends({}, state, {
        pageType: action.pageType
      });
    case types.SET_PAGE_TITLE:
      return _extends({}, state, {
        articleId: action.articleId,
        pageTitle: action.pageTitle,
        pageTopic: action.pageTopic
      });
    case types.SET_ARTICLE_TOPIC_LIST:
      return _extends({}, state, {
        topicArr: action.topicArr
      });
    default:
      return state;
  }
}

exports.default = header;