import { SET_USER_MSG } from '../disptch-types'; import Store from './../../utils/Store'; let userMsg = null; const saveUserMsgLocalized = (msg) => { // console.log("本地存储的用户数据是", msg) Store.saveJsonObject('userMsg', msg) .then(res => { console.log("redux----- 用户信息本地存储成功") }) .catch(e => { console.log("redux----- 用户信息本地存储失败!!!!!!") }) } const INITAL_STATE = userMsg; export default function userMsgReducer(state = INITAL_STATE, action: any) { switch (action.type) { case SET_USER_MSG: saveUserMsgLocalized(action.msg); return action.msg; default: return state; } };