mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-26 05:16:41 +07:00
cancel comment edit
This commit is contained in:
parent
89076da435
commit
b9ac33d881
5 changed files with 31 additions and 1 deletions
|
@ -50,6 +50,11 @@ export const nodePostComment = (id: number, is_before: boolean) => ({
|
|||
type: NODE_ACTIONS.POST_COMMENT,
|
||||
});
|
||||
|
||||
export const nodeCancelCommentEdit = (id: number) => ({
|
||||
id,
|
||||
type: NODE_ACTIONS.CANCEL_COMMENT_EDIT,
|
||||
});
|
||||
|
||||
export const nodeSetSendingComment = (is_sending_comment: boolean) => ({
|
||||
is_sending_comment,
|
||||
type: NODE_ACTIONS.SET_SENDING_COMMENT,
|
||||
|
|
|
@ -27,6 +27,7 @@ export const NODE_ACTIONS = {
|
|||
LOCK: `${prefix}LOCK`,
|
||||
LOCK_COMMENT: `${prefix}LOCK_COMMENT`,
|
||||
EDIT_COMMENT: `${prefix}EDIT_COMMENT`,
|
||||
CANCEL_COMMENT_EDIT: `${prefix}CANCEL_COMMENT_EDIT`,
|
||||
CREATE: `${prefix}CREATE`,
|
||||
|
||||
SET_SAVE_ERRORS: `${prefix}SET_SAVE_ERRORS`,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue