diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-08-22 17:08:55 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:05:44 +0200 |
| commit | 1ddbbd3563af77a218020021ea50a8832900b4db (patch) | |
| tree | 5647f9cfde2de3918eeeac58d6c598bb55e50d82 /src/api/sagas/objects.js | |
| parent | 602c3eb9327a3681f5a220e13b8291bb60643cd7 (diff) | |
Add route logic for construction routes
Diffstat (limited to 'src/api/sagas/objects.js')
| -rw-r--r-- | src/api/sagas/objects.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/api/sagas/objects.js b/src/api/sagas/objects.js index fd7830b3..98c766ec 100644 --- a/src/api/sagas/objects.js +++ b/src/api/sagas/objects.js @@ -1,5 +1,5 @@ import {call, put, select} from "redux-saga/effects"; -import {addToSimulationStore, addToUserStore} from "../../actions/objects"; +import {addToStore} from "../../actions/objects"; import {getSimulation} from "../routes/simulations"; import {getUser} from "../routes/users"; @@ -9,16 +9,16 @@ const selectors = { authorization: state => state.objects.authorization, }; -function* fetchAndStoreObject(objectType, id, apiCall, addToStore) { +function* fetchAndStoreObject(objectType, id, apiCall) { const objectStore = yield select(selectors[objectType]); if (!objectStore[id]) { const object = yield apiCall; - yield put(addToStore(object)); + yield put(addToStore(objectType, object)); } } export const fetchAndStoreSimulation = (id) => - fetchAndStoreObject("simulation", id, call(getSimulation, id), addToSimulationStore); + fetchAndStoreObject("simulation", id, call(getSimulation, id)); export const fetchAndStoreUser = (id) => - fetchAndStoreObject("user", id, call(getUser, id), addToUserStore); + fetchAndStoreObject("user", id, call(getUser, id),); |
