mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
added recent to reducer
This commit is contained in:
parent
920a8adaa2
commit
746d10ce8b
8 changed files with 38 additions and 9 deletions
|
@ -2,7 +2,7 @@ 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 } from './actions';
|
||||
import { flowSetNodes, flowSetCellView, flowSetHeroes, flowSetRecent } from './actions';
|
||||
import { IResultWithStatus, INode } from '../types';
|
||||
import { selectFlowNodes } from './selectors';
|
||||
import { reqWrapper } from '../auth/sagas';
|
||||
|
@ -11,20 +11,23 @@ import { IFlowState } from './reducer';
|
|||
|
||||
function* onGetFlow() {
|
||||
const {
|
||||
data: { nodes = null, heroes = null },
|
||||
}: IResultWithStatus<{ nodes: IFlowState['nodes']; heroes: IFlowState['heroes'] }> = yield call(
|
||||
getNodes,
|
||||
{}
|
||||
);
|
||||
data: { nodes = null, heroes = null, recent = null },
|
||||
}: IResultWithStatus<{
|
||||
nodes: IFlowState['nodes'];
|
||||
heroes: IFlowState['heroes'];
|
||||
recent: IFlowState['recent'];
|
||||
}> = yield call(getNodes, {});
|
||||
|
||||
if (!nodes || !nodes.length) {
|
||||
yield put(flowSetNodes([]));
|
||||
yield put(flowSetHeroes([]));
|
||||
yield put(flowSetRecent([]));
|
||||
return;
|
||||
}
|
||||
|
||||
yield put(flowSetNodes(nodes));
|
||||
yield put(flowSetHeroes(heroes));
|
||||
yield put(flowSetRecent(recent));
|
||||
}
|
||||
|
||||
function* onSetCellView({ id, flow }: ReturnType<typeof flowSetCellView>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue