mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
storing flow cell view
This commit is contained in:
parent
7254a448c1
commit
1d40eca79e
6 changed files with 26 additions and 7 deletions
|
@ -4,13 +4,13 @@ import { FLOW_ACTIONS } from './constants';
|
|||
import { getNodes } from '../node/api';
|
||||
import { flowSetNodes, flowSetCellView } from './actions';
|
||||
import { IResultWithStatus, INode } from '../types';
|
||||
import { updateNodeEverywhere } from '../node/sagas';
|
||||
import { selectFlowNodes } from './selectors';
|
||||
import { reqWrapper } from '../auth/sagas';
|
||||
import { postCellView } from './api';
|
||||
|
||||
function* onGetFlow() {
|
||||
const {
|
||||
data: { nodes = null },
|
||||
error,
|
||||
}: IResultWithStatus<{ nodes: INode[] }> = yield call(getNodes, {});
|
||||
|
||||
if (!nodes || !nodes.length) {
|
||||
|
@ -24,6 +24,10 @@ function* onGetFlow() {
|
|||
function* onSetCellView({ id, flow }: ReturnType<typeof flowSetCellView>) {
|
||||
const nodes = yield select(selectFlowNodes);
|
||||
yield put(flowSetNodes(nodes.map(node => (node.id === id ? { ...node, flow } : node))));
|
||||
|
||||
const { data, error } = yield call(reqWrapper, postCellView, { id, flow });
|
||||
|
||||
console.log({ data, error });
|
||||
}
|
||||
|
||||
export default function* nodeSaga() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue