|
|
@@ -1,4 +1,5 @@
|
|
|
-import { queryCurrent, query as queryUsers } from '@/services/user'
|
|
|
+import consts from '@/consts'
|
|
|
+import { apiCurrent } from '@/services/user'
|
|
|
|
|
|
const UserModel = {
|
|
|
namespace: 'user',
|
|
|
@@ -6,20 +7,22 @@ const UserModel = {
|
|
|
currentUser: {}
|
|
|
},
|
|
|
effects: {
|
|
|
- *fetch(_, { call, put }) {
|
|
|
- const response = yield call(queryUsers)
|
|
|
- yield put({
|
|
|
- type: 'save',
|
|
|
- payload: response
|
|
|
- })
|
|
|
- },
|
|
|
+ // *fetch(_, { call, put }) {
|
|
|
+ // const response = yield call(queryUsers)
|
|
|
+ // yield put({
|
|
|
+ // type: 'save',
|
|
|
+ // payload: response
|
|
|
+ // })
|
|
|
+ // },
|
|
|
|
|
|
*fetchCurrent(_, { call, put }) {
|
|
|
- const response = yield call(queryCurrent)
|
|
|
- yield put({
|
|
|
- type: 'saveCurrentUser',
|
|
|
- payload: response
|
|
|
- })
|
|
|
+ const response = yield call(apiCurrent)
|
|
|
+ if (response && response.code === consts.RET_CODE.SUCCESS) {
|
|
|
+ yield put({
|
|
|
+ type: 'saveCurrentUser',
|
|
|
+ payload: response.data
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
reducers: {
|