...
|
...
|
@@ -52,6 +52,8 @@ const { |
|
|
SETTING_MODI_NICKNAME,
|
|
|
SETTING_MODI_SIGNATURE,
|
|
|
|
|
|
USER_DID_LOGOUT,
|
|
|
|
|
|
} = require('../../constants/actionTypes').default;
|
|
|
|
|
|
const initialState = new InitialState;
|
...
|
...
|
@@ -62,11 +64,6 @@ export default function user(state = initialState, action) { |
|
|
}
|
|
|
|
|
|
switch (action.type) {
|
|
|
case USER_BACKGROUND_TAP:
|
|
|
{
|
|
|
// let nextState = state.set
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case USER_POSTS_REQUEST: {
|
|
|
let nextState = state.setIn(['posts', 'isFetching'], true)
|
...
|
...
|
@@ -74,7 +71,6 @@ export default function user(state = initialState, action) { |
|
|
.set('ptr', action.payload);
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case USER_LIKE_REQUEST: {
|
|
|
let nextState = state.setIn(['like', 'isFetching'], true)
|
...
|
...
|
@@ -82,7 +78,6 @@ export default function user(state = initialState, action) { |
|
|
.set('ptr', action.payload);
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case USER_REPLY_REQUEST: {
|
|
|
let nextState = state.setIn(['reply', 'isFetching'], true)
|
...
|
...
|
@@ -90,10 +85,8 @@ export default function user(state = initialState, action) { |
|
|
.set('ptr', action.payload);
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case USER_POSTS_SUCCESS:
|
|
|
{
|
|
|
case USER_POSTS_SUCCESS: {
|
|
|
// let nextState = state.set
|
|
|
let {lastedTime, list, endReached} = action.payload;
|
|
|
|
...
|
...
|
@@ -106,10 +99,8 @@ export default function user(state = initialState, action) { |
|
|
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case USER_LIKE_SUCCESS:
|
|
|
{
|
|
|
case USER_LIKE_SUCCESS: {
|
|
|
// let nextState = state.set
|
|
|
let {lastedTime, list, endReached} = action.payload;
|
|
|
|
...
|
...
|
@@ -122,10 +113,8 @@ export default function user(state = initialState, action) { |
|
|
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case USER_REPLY_SUCCESS:
|
|
|
{
|
|
|
case USER_REPLY_SUCCESS: {
|
|
|
// let nextState = state.set
|
|
|
let {lastedTime, list, endReached} = action.payload;
|
|
|
|
...
|
...
|
@@ -138,7 +127,6 @@ export default function user(state = initialState, action) { |
|
|
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case USER_POSTS_FAILURE: {
|
|
|
let nextState = state.setIn(['posts', 'isFetching'], false)
|
...
|
...
|
@@ -146,7 +134,6 @@ export default function user(state = initialState, action) { |
|
|
.set('ptr', false);
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case USER_LIKE_FAILURE: {
|
|
|
let nextState = state.setIn(['like', 'isFetching'], false)
|
...
|
...
|
@@ -154,7 +141,6 @@ export default function user(state = initialState, action) { |
|
|
.set('ptr', false);
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case USER_REPLY_FAILURE: {
|
|
|
let nextState = state.setIn(['reply', 'isFetching'], false)
|
...
|
...
|
@@ -162,18 +148,15 @@ export default function user(state = initialState, action) { |
|
|
.set('ptr', false);
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case USER_GO_TO_SETTING_STATS:
|
|
|
return state;
|
|
|
break;
|
|
|
|
|
|
case SYNC_USER_REQUEST: {
|
|
|
let nextState = state.setIn(['profile', 'isFetching'], true)
|
|
|
.setIn(['profile', 'error'], null);
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case SYNC_USER_SUCCESS: {
|
|
|
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) { |
|
|
.setIn(['setting', 'signature'], sign);
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case SYNC_USER_FAILURE: {
|
|
|
let nextState = state.setIn(['profile', 'isFetching'], false)
|
|
|
.setIn(['profile', 'error'], action.payload);
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case SET_UID:
|
|
|
return state.setIn(['profile', 'uid'], action.payload);
|
|
|
break;
|
|
|
|
|
|
case USER_SET_ACTIVE_TAB:
|
|
|
return state.set('activeTab', action.payload);
|
|
|
break;
|
|
|
|
|
|
case USER_CLEAN:
|
|
|
{
|
|
|
case USER_CLEAN: {
|
|
|
let nextState = initialState.set('profile', state.profile);
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case USER_UNREAD_SUCCESS:
|
|
|
return state.setIn(['profile', 'msgCount'], action.payload);
|
|
|
break;
|
|
|
|
|
|
case USER_UNREAD_FAILURE:
|
|
|
return state.setIn(['profile','error'], action.payload);
|
|
|
break;
|
|
|
|
|
|
case USER_AVATAR_UPLOADING:{
|
|
|
let nextState = state.set('avatarUploading',true).set('avatarUploadError',null);
|
|
|
let nextState = state.set('avatarUploading',true).set('avatarUploadError', null);
|
|
|
return nextState;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case USER_AVATAR_UPLOAD_SUCCESS:{
|
|
|
let nextState = state.set('avatarUploading',false).set('avatarUploadError',null);
|
|
|
let nextState = state.set('avatarUploading', false).set('avatarUploadError', null);
|
|
|
return nextState;
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
case USER_AVATAR_UPLOAD_FAILURE: {
|
|
|
let nextState = state.set('avatarUploading',false).set('avatarUploadError',action.payload);
|
|
|
let nextState = state.set('avatarUploading', false).set('avatarUploadError', action.payload);
|
|
|
return nextState;
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
case USER_BG_UPLOADING: {
|
|
|
let nextState = state.set('bgUploading',true).set('bgUploadError',null);
|
|
|
let nextState = state.set('bgUploading', true).set('bgUploadError', null);
|
|
|
return nextState;
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
case USER_BG_UPLOAD_SUCCESS: {
|
|
|
let nextState = state.set('bgUploading',false).set('bgUploadError',null);
|
|
|
let nextState = state.set('bgUploading', false).set('bgUploadError', null);
|
|
|
return nextState;
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
case USER_BG_UPLOAD_FAILURE: {
|
|
|
let nextState = state.set('bgUploading',false).set('bgUploadError',action.payload);
|
|
|
let nextState = state.set('bgUploading', false).set('bgUploadError', action.payload);
|
|
|
return nextState;
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case POST_LIKE_REQUEST: {
|
|
|
return userCenterNewLikeState(state, action.payload, true);
|
|
|
}
|
...
|
...
|
@@ -274,36 +243,25 @@ export default function user(state = initialState, action) { |
|
|
return state.setIn(['setting', 'error'], null)
|
|
|
.setIn(['setting','success'], false);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case SETTING_SAVE_SUCCESS:
|
|
|
{
|
|
|
console.log('state.setting.nickName ==== '+state.setting.nickName);
|
|
|
console.log('state.setting.signature ==== '+state.setting.signature);
|
|
|
case SETTING_SAVE_SUCCESS: {
|
|
|
return state.setIn(['setting', 'error'], null)
|
|
|
.setIn(['profile','nickName'], state.setting.nickName)
|
|
|
.setIn(['profile','sign'], state.setting.signature)
|
|
|
.setIn(['setting','success'], true);
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case SETTING_SAVE_FAILURE:
|
|
|
return state.setIn(['setting', 'error'], action.payload)
|
|
|
.setIn(['setting','success'], false);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case SETTING_MODI_NICKNAME:
|
|
|
console.log('set nike name ====' + action.payload);
|
|
|
return state.setIn(['setting', 'nickName'], action.payload);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case SETTING_MODI_SIGNATURE:
|
|
|
return state.setIn(['setting', 'signature'], action.payload);
|
|
|
|
|
|
break;
|
|
|
case USER_DID_LOGOUT:
|
|
|
return initialState;
|
|
|
|
|
|
}
|
|
|
|
...
|
...
|
|