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

added illustrations

This commit is contained in:
Fedor Katurov 2019-11-08 17:11:36 +07:00
parent 23f935aeeb
commit f355bec236
6 changed files with 1435 additions and 6 deletions

View file

@ -18,8 +18,9 @@ export const nodeGotoNode = (id: number, node_type: INode['type']) => ({
type: NODE_ACTIONS.GOTO_NODE,
});
export const nodeLoadNode = (id: number) => ({
export const nodeLoadNode = (id: number, order?: 'ASC' | 'DESC') => ({
id,
order,
type: NODE_ACTIONS.LOAD_NODE,
});

View file

@ -58,12 +58,14 @@ export const postNodeComment = ({
export const getNodeComments = ({
id,
access,
order = 'ASC',
}: {
id: number;
access: string;
order: 'ASC' | 'DESC';
}): Promise<IResultWithStatus<{ comments: Comment[] }>> =>
api
.get(API.NODE.COMMENT(id), configWithToken(access))
.get(API.NODE.COMMENT(id), configWithToken(access, { params: { order } }))
.then(resultMiddleware)
.catch(errorMiddleware);

View file

@ -96,7 +96,7 @@ function* onNodeGoto({ id, node_type }: ReturnType<typeof nodeGotoNode>) {
yield put(push(URLS.NODE_URL(id)));
}
function* onNodeLoad({ id }: ReturnType<typeof nodeLoadNode>) {
function* onNodeLoad({ id, order = 'ASC' }: ReturnType<typeof nodeLoadNode>) {
yield put(nodeSetLoading(true));
yield put(nodeSetLoadingComments(true));
yield put(nodeSetCommentData(0, { ...EMPTY_COMMENT }));
@ -123,7 +123,7 @@ function* onNodeLoad({ id }: ReturnType<typeof nodeLoadNode>) {
data: { related },
},
} = yield all({
comments: call(reqWrapper, getNodeComments, { id }),
comments: call(reqWrapper, getNodeComments, { id, order }),
related: call(reqWrapper, getNodeRelated, { id }),
});