parent
							
								
									5f53297917
								
							
						
					
					
						commit
						26294c47af
					
				| @ -0,0 +1,16 @@ | |||||||
|  | /* | ||||||
|  |  * @Description:  | ||||||
|  |  * @Author: tangjiang | ||||||
|  |  * @Github:  | ||||||
|  |  * @Date: 2019-12-06 15:09:22 | ||||||
|  |  * @LastEditors: tangjiang | ||||||
|  |  * @LastEditTime: 2019-12-06 15:15:00 | ||||||
|  |  */ | ||||||
|  | import types from './actionTypes'; | ||||||
|  | 
 | ||||||
|  | // 获取用户信息
 | ||||||
|  | export default function getUserInfo () { | ||||||
|  |   return (dispatch) => { | ||||||
|  |     // 调用获取用户信息, 如果没有登录直接调用登录,成功后保存当前用户信息
 | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,31 @@ | |||||||
|  | /* | ||||||
|  |  * @Description: 保存信息数据 | ||||||
|  |  * @Author: tangjiang | ||||||
|  |  * @Github:  | ||||||
|  |  * @Date: 2019-12-06 15:09:29 | ||||||
|  |  * @LastEditors: tangjiang | ||||||
|  |  * @LastEditTime: 2019-12-06 15:16:15 | ||||||
|  |  */ | ||||||
|  | import types from "../actions/actionTypes"; | ||||||
|  | 
 | ||||||
|  | const initialState = { | ||||||
|  |   userInfo: {} // 当前登录用户信息
 | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | const userReducer = (state = initialState, action) => { | ||||||
|  |   switch (action.type) { | ||||||
|  |     case types.SAVE_USER_INFO: | ||||||
|  |       return { | ||||||
|  |         userInfo: action.payload | ||||||
|  |       } | ||||||
|  |     default: | ||||||
|  |       return { | ||||||
|  |         ...state | ||||||
|  |       } | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export default userReducer; | ||||||
|  | export { | ||||||
|  |   userReducer | ||||||
|  | }; | ||||||
					Loading…
					
					
				
		Reference in new issue