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

added saga to change tags

This commit is contained in:
Fedor Katurov 2019-10-09 16:12:27 +07:00
parent 033b5ca45d
commit 9df5e022dd
7 changed files with 44 additions and 11 deletions

View file

@ -13,8 +13,9 @@ import {
nodeSetSendingComment,
nodeSetComments,
nodeSetCommentData,
nodeUpdateTags,
} from './actions';
import { postNode, getNode, postNodeComment, getNodeComments } from './api';
import { postNode, getNode, postNodeComment, getNodeComments, updateNodeTags } from './api';
import { reqWrapper } from '../auth/sagas';
import { flowSetNodes } from '../flow/actions';
import { ERRORS } from '~/constants/errors';
@ -102,8 +103,16 @@ function* onPostComment({ id }: ReturnType<typeof nodePostComment>) {
}
}
function* onUpdateTags({ id, tags }: ReturnType<typeof nodeUpdateTags>) {
yield delay(1000);
const result = yield call(reqWrapper, updateNodeTags, { id, tags });
console.log({ result });
}
export default function* nodeSaga() {
yield takeLatest(NODE_ACTIONS.SAVE, onNodeSave);
yield takeLatest(NODE_ACTIONS.LOAD_NODE, onNodeLoad);
yield takeLatest(NODE_ACTIONS.POST_COMMENT, onPostComment);
yield takeLatest(NODE_ACTIONS.UPDATE_TAGS, onUpdateTags);
}