1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

added updated nodes to flow

This commit is contained in:
Fedor Katurov 2019-10-30 17:26:30 +07:00
parent 6f76bec2c0
commit 74cd181530
13 changed files with 128 additions and 30 deletions

View file

@ -2,7 +2,13 @@ import { takeLatest, call, put, select } from 'redux-saga/effects';
import { REHYDRATE } from 'redux-persist';
import { FLOW_ACTIONS } from './constants';
import { getNodes } from '../node/api';
import { flowSetNodes, flowSetCellView, flowSetHeroes, flowSetRecent } from './actions';
import {
flowSetNodes,
flowSetCellView,
flowSetHeroes,
flowSetRecent,
flowSetUpdated,
} from './actions';
import { IResultWithStatus, INode } from '../types';
import { selectFlowNodes } from './selectors';
import { reqWrapper } from '../auth/sagas';
@ -11,23 +17,26 @@ import { IFlowState } from './reducer';
function* onGetFlow() {
const {
data: { nodes = null, heroes = null, recent = null },
data: { nodes = null, heroes = null, recent = [], updated = [] },
}: IResultWithStatus<{
nodes: IFlowState['nodes'];
heroes: IFlowState['heroes'];
recent: IFlowState['recent'];
}> = yield call(getNodes, {});
updated: IFlowState['updated'];
}> = yield call(reqWrapper, getNodes, {});
if (!nodes || !nodes.length) {
yield put(flowSetNodes([]));
yield put(flowSetHeroes([]));
yield put(flowSetRecent([]));
yield put(flowSetUpdated([]));
return;
}
yield put(flowSetNodes(nodes));
yield put(flowSetHeroes(heroes));
yield put(flowSetRecent(recent));
yield put(flowSetUpdated(updated));
}
function* onSetCellView({ id, flow }: ReturnType<typeof flowSetCellView>) {