mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 21:06:42 +07:00
added boris route
This commit is contained in:
parent
c8ca961935
commit
cf16cbf0f9
7 changed files with 70 additions and 13 deletions
|
@ -20,6 +20,7 @@ import {
|
|||
nodeEdit,
|
||||
nodeLike,
|
||||
nodeSetRelated,
|
||||
nodeGotoNode,
|
||||
} from './actions';
|
||||
import {
|
||||
postNode,
|
||||
|
@ -89,17 +90,19 @@ function* onNodeSave({ node }: ReturnType<typeof nodeSave>) {
|
|||
return yield put(modalSetShown(false));
|
||||
}
|
||||
|
||||
function* onNodeLoad({ id, node_type }: ReturnType<typeof nodeLoadNode>) {
|
||||
function* onNodeGoto({ id, node_type }: ReturnType<typeof nodeGotoNode>) {
|
||||
if (node_type) yield put(nodeSetCurrent({ ...EMPTY_NODE, type: node_type }));
|
||||
yield put(nodeLoadNode(id));
|
||||
yield put(push(URLS.NODE_URL(id)));
|
||||
}
|
||||
|
||||
function* onNodeLoad({ id }: ReturnType<typeof nodeLoadNode>) {
|
||||
yield put(nodeSetLoading(true));
|
||||
yield put(nodeSetLoadingComments(true));
|
||||
yield put(nodeSetSaveErrors({}));
|
||||
yield put(nodeSetCommentData(0, { ...EMPTY_COMMENT }));
|
||||
yield put(nodeSetRelated(null));
|
||||
|
||||
if (node_type) yield put(nodeSetCurrent({ ...EMPTY_NODE, type: node_type }));
|
||||
|
||||
yield put(push(URLS.NODE_URL(id)));
|
||||
|
||||
const {
|
||||
data: { node, error },
|
||||
} = yield call(reqWrapper, getNode, { id });
|
||||
|
@ -113,7 +116,6 @@ function* onNodeLoad({ id, node_type }: ReturnType<typeof nodeLoadNode>) {
|
|||
yield put(nodeSetSaveErrors({}));
|
||||
yield put(nodeSetCurrent(node));
|
||||
|
||||
// todo: load comments
|
||||
const {
|
||||
comments: {
|
||||
data: { comments },
|
||||
|
@ -232,6 +234,7 @@ function* onStarSaga({ id }: ReturnType<typeof nodeLike>) {
|
|||
|
||||
export default function* nodeSaga() {
|
||||
yield takeLatest(NODE_ACTIONS.SAVE, onNodeSave);
|
||||
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.UPDATE_TAGS, onUpdateTags);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue