authed.js 895 Bytes
import * as types from '../constants/ActionTypes';

const initialState = {
    userInfo       : {},
    registerSeccess: false,
    time           : new Date().getTime(),
    getPermission  :{},
    onlySee        :true,
};

export default function environment(state = initialState, action) {
    switch (action.type) {
        case types.CHANGE_USER_INFO:
            return Object.assign({}, state, {userInfo: action.userInfo});
        case types.REGISTER_SECCESS:
            return Object.assign({}, state, {registerSeccess: action.registerSeccess});
        case types.CHANGE_AVATAR:
            return Object.assign({}, state, {time: action.time});
        case types.GETPERMISSION:
            return Object.assign({}, state, {
                getPermission: action.getPermission,
                onlySee:action.onlySee
            });
        default:
            return state;
    }
}