...
|
...
|
@@ -36,27 +36,39 @@ const { |
|
|
} = require('../../constants/actionTypes').default;
|
|
|
|
|
|
export function goToSection(section) {
|
|
|
Actions.Section();
|
|
|
return {
|
|
|
type: GO_TO_SECTION,
|
|
|
payload: section,
|
|
|
};
|
|
|
return (dispatch, getState) => {
|
|
|
let {route} = getState();
|
|
|
let tryToClean = route.lastPopScene == 'Section';
|
|
|
Actions.Section();
|
|
|
dispatch({
|
|
|
type: GO_TO_SECTION,
|
|
|
payload: {...section, tryToClean},
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function goToPost(id) {
|
|
|
Actions.SubjectPost({postId:id});
|
|
|
return {
|
|
|
type: GO_TO_POST,
|
|
|
payload: id,
|
|
|
};
|
|
|
return (dispatch, getState) => {
|
|
|
let {route} = getState();
|
|
|
let tryToClean = route.lastPopScene == 'SubjectPost';
|
|
|
Actions.SubjectPost({postId:id});
|
|
|
dispatch({
|
|
|
type: GO_TO_POST,
|
|
|
payload: {id, tryToClean},
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function goToLikeList(postId, likeCount) {
|
|
|
Actions.LikeList({title: `共${likeCount}个赞`});
|
|
|
return {
|
|
|
type: GO_TO_LIKE_LIST,
|
|
|
payload: postId,
|
|
|
};
|
|
|
return (dispatch, getState) => {
|
|
|
let {route} = getState();
|
|
|
let tryToClean = route.lastPopScene == 'LikeList';
|
|
|
Actions.LikeList({title: `共${likeCount}个赞`});
|
|
|
dispatch({
|
|
|
type: GO_TO_LIKE_LIST,
|
|
|
payload: {postId, tryToClean},
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function goToUserOrMe(uid) {
|
...
|
...
|
@@ -68,11 +80,7 @@ export function goToUserOrMe(uid) { |
|
|
type: GO_TO_USER,
|
|
|
});
|
|
|
} else {
|
|
|
Actions.UserThatNotMe();
|
|
|
dispatch({
|
|
|
type: GO_TO_USER_THAT_NOT_ME,
|
|
|
payload: uid,
|
|
|
});
|
|
|
dispatch(goToUserThatNotMe(uid));
|
|
|
}
|
|
|
};
|
|
|
}
|
...
|
...
|
@@ -97,14 +105,15 @@ export function goToUser() { |
|
|
|
|
|
export function goToUserThatNotMe(uid) {
|
|
|
return (dispatch, getState) => {
|
|
|
let {user} = getState();
|
|
|
let {user, route} = getState();
|
|
|
if (user.profile.uid == uid) {
|
|
|
|
|
|
} else {
|
|
|
Actions.UserThatNotMe();
|
|
|
let tryToClean = route.lastPopScene == 'UserThatNotMe';
|
|
|
Actions.UserThatNotMe();
|
|
|
dispatch({
|
|
|
type: GO_TO_USER_THAT_NOT_ME,
|
|
|
payload: uid,
|
|
|
payload: {uid, tryToClean},
|
|
|
});
|
|
|
}
|
|
|
};
|
...
|
...
|
|