diff options
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),); |
