mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-26 05:16:41 +07:00
fixed boris comments
This commit is contained in:
parent
0e4c1acc3f
commit
5cb0791752
7 changed files with 163 additions and 90 deletions
|
@ -39,8 +39,9 @@ export const nodeSetCurrent = (current: INodeState['current']) => ({
|
|||
type: NODE_ACTIONS.SET_CURRENT,
|
||||
});
|
||||
|
||||
export const nodePostComment = (id: number) => ({
|
||||
export const nodePostComment = (id: number, is_before: boolean) => ({
|
||||
id,
|
||||
is_before,
|
||||
type: NODE_ACTIONS.POST_COMMENT,
|
||||
});
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ function* onNodeLoad({ id, order = 'ASC' }: ReturnType<typeof nodeLoadNode>) {
|
|||
return;
|
||||
}
|
||||
|
||||
function* onPostComment({ id }: ReturnType<typeof nodePostComment>) {
|
||||
function* onPostComment({ id, is_before }: ReturnType<typeof nodePostComment>) {
|
||||
const { current, comment_data } = yield select(selectNode);
|
||||
|
||||
yield put(nodeSetSendingComment(true));
|
||||
|
@ -170,8 +170,13 @@ function* onPostComment({ id }: ReturnType<typeof nodePostComment>) {
|
|||
if (current_node && current_node.id === current.id) {
|
||||
// if user still browsing that node
|
||||
const { comments } = yield select(selectNode);
|
||||
yield put(nodeSetComments([...comments, comment]));
|
||||
yield put(nodeSetCommentData(0, { ...EMPTY_COMMENT }));
|
||||
|
||||
if (is_before) {
|
||||
yield put(nodeSetComments([comment, ...comments]));
|
||||
} else {
|
||||
yield put(nodeSetComments([...comments, comment]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue