1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 21:06:42 +07:00

cancel comment edit

This commit is contained in:
Fedor Katurov 2019-12-03 16:24:52 +07:00
parent 89076da435
commit b9ac33d881
5 changed files with 31 additions and 1 deletions

View file

@ -26,6 +26,7 @@ import {
nodeLockComment,
nodeEditComment,
nodeSet,
nodeCancelCommentEdit,
} from './actions';
import {
postNode,
@ -197,6 +198,16 @@ function* onPostComment({ id, is_before }: ReturnType<typeof nodePostComment>) {
}
}
function* onCancelCommentEdit({ id }: ReturnType<typeof nodeCancelCommentEdit>) {
const { comment_data } = yield select(selectNode);
yield put(
nodeSet({
comment_data: omit([id.toString()], comment_data),
})
);
}
function* onUpdateTags({ id, tags }: ReturnType<typeof nodeUpdateTags>) {
yield delay(1000);
const {
@ -311,6 +322,7 @@ export default function* nodeSaga() {
yield takeLatest(NODE_ACTIONS.GOTO_NODE, onNodeGoto);
yield takeLatest(NODE_ACTIONS.LOAD_NODE, onNodeLoad);
yield takeLatest(NODE_ACTIONS.POST_COMMENT, onPostComment);
yield takeLatest(NODE_ACTIONS.CANCEL_COMMENT_EDIT, onCancelCommentEdit);
yield takeLatest(NODE_ACTIONS.UPDATE_TAGS, onUpdateTags);
yield takeLatest(NODE_ACTIONS.CREATE, onCreateSaga);
yield takeLatest(NODE_ACTIONS.EDIT, onEditSaga);