vipLevelReducer.js
943 Bytes
'use strict';
import InitialState from './vipLevelInitialState';
import Immutable, {Map} from 'immutable';
const {
SET_NICKNAME,
FETCH_VIP_INFO_REQUEST,
FETCH_VIP_INFO_SUCCESS,
FETCH_VIP_INFO_FAILURE,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
export default function brandReducer(state=initialState, action) {
switch(action.type) {
case FETCH_VIP_INFO_REQUEST:
return state.set('isFetching', true);
case FETCH_VIP_INFO_FAILURE:
return state.set('isFetching', false);
case FETCH_VIP_INFO_SUCCESS:
return state.set('isFetching', false)
.set('vipInfo', Immutable.fromJS(action.payload.vipInfo))
.setIn(['vipShowPageInfo', 'upgradeNeedCost'], action.payload.upgradeNeedCost)
.setIn(['vipShowPageInfo', 'vipNextLevelProgress'], action.payload.vipNextLevelProgress);
case SET_NICKNAME:
return state.set('nickname', action.payload);
}
return state;
}