mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-26 05:16:41 +07:00
fetching and saving nodes
This commit is contained in:
parent
4c49ed000a
commit
209ab25ab0
6 changed files with 18020 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
|||
import { takeLatest, call, put } from 'redux-saga/effects';
|
||||
import { takeLatest, call, put, select } from 'redux-saga/effects';
|
||||
import { NODE_ACTIONS } from './constants';
|
||||
import { nodeSave, nodeSetSaveErrors } from './actions';
|
||||
import { postNode } from './api';
|
||||
|
@ -6,6 +6,7 @@ import { reqWrapper } from '../auth/sagas';
|
|||
import { flowSetNodes } from '../flow/actions';
|
||||
import { ERRORS } from '~/constants/errors';
|
||||
import { modalSetShown } from '../modal/actions';
|
||||
import { selectFlowNodes } from '../flow/selectors';
|
||||
|
||||
function* onNodeSave({ node }: ReturnType<typeof nodeSave>) {
|
||||
yield put(nodeSetSaveErrors({}));
|
||||
|
@ -22,8 +23,9 @@ function* onNodeSave({ node }: ReturnType<typeof nodeSave>) {
|
|||
return yield put(nodeSetSaveErrors({ error: ERRORS.EMPTY_RESPONSE }));
|
||||
}
|
||||
|
||||
yield put(flowSetNodes({ [result.id]: result }));
|
||||
yield put(modalSetShown(false));
|
||||
const nodes = yield select(selectFlowNodes);
|
||||
yield put(flowSetNodes([result, ...nodes]));
|
||||
return yield put(modalSetShown(false));
|
||||
}
|
||||
|
||||
export default function* nodeSaga() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue