|
@@ -52,6 +52,8 @@ const { |
|
@@ -52,6 +52,8 @@ const { |
52
|
SETTING_MODI_NICKNAME,
|
52
|
SETTING_MODI_NICKNAME,
|
53
|
SETTING_MODI_SIGNATURE,
|
53
|
SETTING_MODI_SIGNATURE,
|
54
|
|
54
|
|
|
|
55
|
+ USER_DID_LOGOUT,
|
|
|
56
|
+
|
55
|
} = require('../../constants/actionTypes').default;
|
57
|
} = require('../../constants/actionTypes').default;
|
56
|
|
58
|
|
57
|
const initialState = new InitialState;
|
59
|
const initialState = new InitialState;
|
|
@@ -62,11 +64,6 @@ export default function user(state = initialState, action) { |
|
@@ -62,11 +64,6 @@ export default function user(state = initialState, action) { |
62
|
}
|
64
|
}
|
63
|
|
65
|
|
64
|
switch (action.type) {
|
66
|
switch (action.type) {
|
65
|
- case USER_BACKGROUND_TAP:
|
|
|
66
|
- {
|
|
|
67
|
- // let nextState = state.set
|
|
|
68
|
- }
|
|
|
69
|
- break;
|
|
|
70
|
|
67
|
|
71
|
case USER_POSTS_REQUEST: {
|
68
|
case USER_POSTS_REQUEST: {
|
72
|
let nextState = state.setIn(['posts', 'isFetching'], true)
|
69
|
let nextState = state.setIn(['posts', 'isFetching'], true)
|
|
@@ -74,7 +71,6 @@ export default function user(state = initialState, action) { |
|
@@ -74,7 +71,6 @@ export default function user(state = initialState, action) { |
74
|
.set('ptr', action.payload);
|
71
|
.set('ptr', action.payload);
|
75
|
return nextState;
|
72
|
return nextState;
|
76
|
}
|
73
|
}
|
77
|
- break;
|
|
|
78
|
|
74
|
|
79
|
case USER_LIKE_REQUEST: {
|
75
|
case USER_LIKE_REQUEST: {
|
80
|
let nextState = state.setIn(['like', 'isFetching'], true)
|
76
|
let nextState = state.setIn(['like', 'isFetching'], true)
|
|
@@ -82,7 +78,6 @@ export default function user(state = initialState, action) { |
|
@@ -82,7 +78,6 @@ export default function user(state = initialState, action) { |
82
|
.set('ptr', action.payload);
|
78
|
.set('ptr', action.payload);
|
83
|
return nextState;
|
79
|
return nextState;
|
84
|
}
|
80
|
}
|
85
|
- break;
|
|
|
86
|
|
81
|
|
87
|
case USER_REPLY_REQUEST: {
|
82
|
case USER_REPLY_REQUEST: {
|
88
|
let nextState = state.setIn(['reply', 'isFetching'], true)
|
83
|
let nextState = state.setIn(['reply', 'isFetching'], true)
|
|
@@ -90,10 +85,8 @@ export default function user(state = initialState, action) { |
|
@@ -90,10 +85,8 @@ export default function user(state = initialState, action) { |
90
|
.set('ptr', action.payload);
|
85
|
.set('ptr', action.payload);
|
91
|
return nextState;
|
86
|
return nextState;
|
92
|
}
|
87
|
}
|
93
|
- break;
|
|
|
94
|
|
88
|
|
95
|
- case USER_POSTS_SUCCESS:
|
|
|
96
|
- {
|
89
|
+ case USER_POSTS_SUCCESS: {
|
97
|
// let nextState = state.set
|
90
|
// let nextState = state.set
|
98
|
let {lastedTime, list, endReached} = action.payload;
|
91
|
let {lastedTime, list, endReached} = action.payload;
|
99
|
|
92
|
|
|
@@ -106,10 +99,8 @@ export default function user(state = initialState, action) { |
|
@@ -106,10 +99,8 @@ export default function user(state = initialState, action) { |
106
|
|
99
|
|
107
|
return nextState;
|
100
|
return nextState;
|
108
|
}
|
101
|
}
|
109
|
- break;
|
|
|
110
|
|
102
|
|
111
|
- case USER_LIKE_SUCCESS:
|
|
|
112
|
- {
|
103
|
+ case USER_LIKE_SUCCESS: {
|
113
|
// let nextState = state.set
|
104
|
// let nextState = state.set
|
114
|
let {lastedTime, list, endReached} = action.payload;
|
105
|
let {lastedTime, list, endReached} = action.payload;
|
115
|
|
106
|
|
|
@@ -122,10 +113,8 @@ export default function user(state = initialState, action) { |
|
@@ -122,10 +113,8 @@ export default function user(state = initialState, action) { |
122
|
|
113
|
|
123
|
return nextState;
|
114
|
return nextState;
|
124
|
}
|
115
|
}
|
125
|
- break;
|
|
|
126
|
|
116
|
|
127
|
- case USER_REPLY_SUCCESS:
|
|
|
128
|
- {
|
117
|
+ case USER_REPLY_SUCCESS: {
|
129
|
// let nextState = state.set
|
118
|
// let nextState = state.set
|
130
|
let {lastedTime, list, endReached} = action.payload;
|
119
|
let {lastedTime, list, endReached} = action.payload;
|
131
|
|
120
|
|
|
@@ -138,7 +127,6 @@ export default function user(state = initialState, action) { |
|
@@ -138,7 +127,6 @@ export default function user(state = initialState, action) { |
138
|
|
127
|
|
139
|
return nextState;
|
128
|
return nextState;
|
140
|
}
|
129
|
}
|
141
|
- break;
|
|
|
142
|
|
130
|
|
143
|
case USER_POSTS_FAILURE: {
|
131
|
case USER_POSTS_FAILURE: {
|
144
|
let nextState = state.setIn(['posts', 'isFetching'], false)
|
132
|
let nextState = state.setIn(['posts', 'isFetching'], false)
|
|
@@ -146,7 +134,6 @@ export default function user(state = initialState, action) { |
|
@@ -146,7 +134,6 @@ export default function user(state = initialState, action) { |
146
|
.set('ptr', false);
|
134
|
.set('ptr', false);
|
147
|
return nextState;
|
135
|
return nextState;
|
148
|
}
|
136
|
}
|
149
|
- break;
|
|
|
150
|
|
137
|
|
151
|
case USER_LIKE_FAILURE: {
|
138
|
case USER_LIKE_FAILURE: {
|
152
|
let nextState = state.setIn(['like', 'isFetching'], false)
|
139
|
let nextState = state.setIn(['like', 'isFetching'], false)
|
|
@@ -154,7 +141,6 @@ export default function user(state = initialState, action) { |
|
@@ -154,7 +141,6 @@ export default function user(state = initialState, action) { |
154
|
.set('ptr', false);
|
141
|
.set('ptr', false);
|
155
|
return nextState;
|
142
|
return nextState;
|
156
|
}
|
143
|
}
|
157
|
- break;
|
|
|
158
|
|
144
|
|
159
|
case USER_REPLY_FAILURE: {
|
145
|
case USER_REPLY_FAILURE: {
|
160
|
let nextState = state.setIn(['reply', 'isFetching'], false)
|
146
|
let nextState = state.setIn(['reply', 'isFetching'], false)
|
|
@@ -162,18 +148,15 @@ export default function user(state = initialState, action) { |
|
@@ -162,18 +148,15 @@ export default function user(state = initialState, action) { |
162
|
.set('ptr', false);
|
148
|
.set('ptr', false);
|
163
|
return nextState;
|
149
|
return nextState;
|
164
|
}
|
150
|
}
|
165
|
- break;
|
|
|
166
|
|
151
|
|
167
|
case USER_GO_TO_SETTING_STATS:
|
152
|
case USER_GO_TO_SETTING_STATS:
|
168
|
return state;
|
153
|
return state;
|
169
|
- break;
|
|
|
170
|
|
154
|
|
171
|
case SYNC_USER_REQUEST: {
|
155
|
case SYNC_USER_REQUEST: {
|
172
|
let nextState = state.setIn(['profile', 'isFetching'], true)
|
156
|
let nextState = state.setIn(['profile', 'isFetching'], true)
|
173
|
.setIn(['profile', 'error'], null);
|
157
|
.setIn(['profile', 'error'], null);
|
174
|
return nextState;
|
158
|
return nextState;
|
175
|
}
|
159
|
}
|
176
|
- break;
|
|
|
177
|
|
160
|
|
178
|
case SYNC_USER_SUCCESS: {
|
161
|
case SYNC_USER_SUCCESS: {
|
179
|
let {avatar, backgroundImage, nickName, realName, gender, sign, age, birthday, height, weight, msgCount} = action.payload;
|
162
|
let {avatar, backgroundImage, nickName, realName, gender, sign, age, birthday, height, weight, msgCount} = action.payload;
|
|
@@ -194,74 +177,60 @@ export default function user(state = initialState, action) { |
|
@@ -194,74 +177,60 @@ export default function user(state = initialState, action) { |
194
|
.setIn(['setting', 'signature'], sign);
|
177
|
.setIn(['setting', 'signature'], sign);
|
195
|
return nextState;
|
178
|
return nextState;
|
196
|
}
|
179
|
}
|
197
|
- break;
|
|
|
198
|
|
180
|
|
199
|
case SYNC_USER_FAILURE: {
|
181
|
case SYNC_USER_FAILURE: {
|
200
|
let nextState = state.setIn(['profile', 'isFetching'], false)
|
182
|
let nextState = state.setIn(['profile', 'isFetching'], false)
|
201
|
.setIn(['profile', 'error'], action.payload);
|
183
|
.setIn(['profile', 'error'], action.payload);
|
202
|
return nextState;
|
184
|
return nextState;
|
203
|
}
|
185
|
}
|
204
|
- break;
|
|
|
205
|
|
186
|
|
206
|
case SET_UID:
|
187
|
case SET_UID:
|
207
|
return state.setIn(['profile', 'uid'], action.payload);
|
188
|
return state.setIn(['profile', 'uid'], action.payload);
|
208
|
- break;
|
|
|
209
|
|
189
|
|
210
|
case USER_SET_ACTIVE_TAB:
|
190
|
case USER_SET_ACTIVE_TAB:
|
211
|
return state.set('activeTab', action.payload);
|
191
|
return state.set('activeTab', action.payload);
|
212
|
- break;
|
|
|
213
|
|
192
|
|
214
|
- case USER_CLEAN:
|
|
|
215
|
- {
|
193
|
+ case USER_CLEAN: {
|
216
|
let nextState = initialState.set('profile', state.profile);
|
194
|
let nextState = initialState.set('profile', state.profile);
|
217
|
return nextState;
|
195
|
return nextState;
|
218
|
}
|
196
|
}
|
219
|
- break;
|
|
|
220
|
|
197
|
|
221
|
case USER_UNREAD_SUCCESS:
|
198
|
case USER_UNREAD_SUCCESS:
|
222
|
return state.setIn(['profile', 'msgCount'], action.payload);
|
199
|
return state.setIn(['profile', 'msgCount'], action.payload);
|
223
|
- break;
|
|
|
224
|
|
200
|
|
225
|
case USER_UNREAD_FAILURE:
|
201
|
case USER_UNREAD_FAILURE:
|
226
|
return state.setIn(['profile','error'], action.payload);
|
202
|
return state.setIn(['profile','error'], action.payload);
|
227
|
- break;
|
|
|
228
|
|
203
|
|
229
|
case USER_AVATAR_UPLOADING:{
|
204
|
case USER_AVATAR_UPLOADING:{
|
230
|
- let nextState = state.set('avatarUploading',true).set('avatarUploadError',null);
|
205
|
+ let nextState = state.set('avatarUploading',true).set('avatarUploadError', null);
|
231
|
return nextState;
|
206
|
return nextState;
|
232
|
}
|
207
|
}
|
233
|
- break;
|
208
|
+
|
234
|
case USER_AVATAR_UPLOAD_SUCCESS:{
|
209
|
case USER_AVATAR_UPLOAD_SUCCESS:{
|
235
|
- let nextState = state.set('avatarUploading',false).set('avatarUploadError',null);
|
210
|
+ let nextState = state.set('avatarUploading', false).set('avatarUploadError', null);
|
236
|
return nextState;
|
211
|
return nextState;
|
237
|
}
|
212
|
}
|
238
|
|
213
|
|
239
|
- break;
|
|
|
240
|
case USER_AVATAR_UPLOAD_FAILURE: {
|
214
|
case USER_AVATAR_UPLOAD_FAILURE: {
|
241
|
- let nextState = state.set('avatarUploading',false).set('avatarUploadError',action.payload);
|
215
|
+ let nextState = state.set('avatarUploading', false).set('avatarUploadError', action.payload);
|
242
|
return nextState;
|
216
|
return nextState;
|
243
|
}
|
217
|
}
|
244
|
|
218
|
|
245
|
- break;
|
|
|
246
|
case USER_BG_UPLOADING: {
|
219
|
case USER_BG_UPLOADING: {
|
247
|
- let nextState = state.set('bgUploading',true).set('bgUploadError',null);
|
220
|
+ let nextState = state.set('bgUploading', true).set('bgUploadError', null);
|
248
|
return nextState;
|
221
|
return nextState;
|
249
|
}
|
222
|
}
|
250
|
|
223
|
|
251
|
- break;
|
|
|
252
|
case USER_BG_UPLOAD_SUCCESS: {
|
224
|
case USER_BG_UPLOAD_SUCCESS: {
|
253
|
- let nextState = state.set('bgUploading',false).set('bgUploadError',null);
|
225
|
+ let nextState = state.set('bgUploading', false).set('bgUploadError', null);
|
254
|
return nextState;
|
226
|
return nextState;
|
255
|
}
|
227
|
}
|
256
|
|
228
|
|
257
|
- break;
|
|
|
258
|
case USER_BG_UPLOAD_FAILURE: {
|
229
|
case USER_BG_UPLOAD_FAILURE: {
|
259
|
- let nextState = state.set('bgUploading',false).set('bgUploadError',action.payload);
|
230
|
+ let nextState = state.set('bgUploading', false).set('bgUploadError', action.payload);
|
260
|
return nextState;
|
231
|
return nextState;
|
261
|
}
|
232
|
}
|
262
|
|
233
|
|
263
|
- break;
|
|
|
264
|
-
|
|
|
265
|
case POST_LIKE_REQUEST: {
|
234
|
case POST_LIKE_REQUEST: {
|
266
|
return userCenterNewLikeState(state, action.payload, true);
|
235
|
return userCenterNewLikeState(state, action.payload, true);
|
267
|
}
|
236
|
}
|
|
@@ -274,36 +243,25 @@ export default function user(state = initialState, action) { |
|
@@ -274,36 +243,25 @@ export default function user(state = initialState, action) { |
274
|
return state.setIn(['setting', 'error'], null)
|
243
|
return state.setIn(['setting', 'error'], null)
|
275
|
.setIn(['setting','success'], false);
|
244
|
.setIn(['setting','success'], false);
|
276
|
|
245
|
|
277
|
- break;
|
|
|
278
|
-
|
|
|
279
|
- case SETTING_SAVE_SUCCESS:
|
|
|
280
|
- {
|
|
|
281
|
- console.log('state.setting.nickName ==== '+state.setting.nickName);
|
|
|
282
|
- console.log('state.setting.signature ==== '+state.setting.signature);
|
246
|
+ case SETTING_SAVE_SUCCESS: {
|
283
|
return state.setIn(['setting', 'error'], null)
|
247
|
return state.setIn(['setting', 'error'], null)
|
284
|
- .setIn(['profile','nickName'], state.setting.nickName)
|
|
|
285
|
- .setIn(['profile','sign'], state.setting.signature)
|
|
|
286
|
- .setIn(['setting','success'], true);
|
248
|
+ .setIn(['profile','nickName'], state.setting.nickName)
|
|
|
249
|
+ .setIn(['profile','sign'], state.setting.signature)
|
|
|
250
|
+ .setIn(['setting','success'], true);
|
287
|
}
|
251
|
}
|
288
|
|
252
|
|
289
|
- break;
|
|
|
290
|
-
|
|
|
291
|
case SETTING_SAVE_FAILURE:
|
253
|
case SETTING_SAVE_FAILURE:
|
292
|
return state.setIn(['setting', 'error'], action.payload)
|
254
|
return state.setIn(['setting', 'error'], action.payload)
|
293
|
- .setIn(['setting','success'], false);
|
|
|
294
|
-
|
|
|
295
|
- break;
|
255
|
+ .setIn(['setting','success'], false);
|
296
|
|
256
|
|
297
|
case SETTING_MODI_NICKNAME:
|
257
|
case SETTING_MODI_NICKNAME:
|
298
|
- console.log('set nike name ====' + action.payload);
|
|
|
299
|
return state.setIn(['setting', 'nickName'], action.payload);
|
258
|
return state.setIn(['setting', 'nickName'], action.payload);
|
300
|
|
259
|
|
301
|
- break;
|
|
|
302
|
-
|
|
|
303
|
case SETTING_MODI_SIGNATURE:
|
260
|
case SETTING_MODI_SIGNATURE:
|
304
|
return state.setIn(['setting', 'signature'], action.payload);
|
261
|
return state.setIn(['setting', 'signature'], action.payload);
|
305
|
|
262
|
|
306
|
- break;
|
263
|
+ case USER_DID_LOGOUT:
|
|
|
264
|
+ return initialState;
|
307
|
|
265
|
|
308
|
}
|
266
|
}
|
309
|
|
267
|
|