import * as types from '../actions/types';

const initialState = {
  basename: null,
  base_api_url: null
};

export default (state = initialState, action) => {
  switch (action.type) {
    case types.CONFIG_SET_SUCCESS:
      return {
        ...state,
        basename: action.base_api_url,
        base_api_url: action.base_api_url
      };
    case types.CONFIG_SET_ERROR:
      return initialState;
    default:
      return state;
  }
};
