diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-08-25 17:48:12 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:05:44 +0200 |
| commit | c47a27b826f7d76410308a4151611a366f9eaf46 (patch) | |
| tree | c1ca374204714cedabcacb8620848b903a0bf8d6 /src/api/sagas/objects.js | |
| parent | 1ddbbd3563af77a218020021ea50a8832900b4db (diff) | |
Fetch and display datacenter topology
Diffstat (limited to 'src/api/sagas/objects.js')
| -rw-r--r-- | src/api/sagas/objects.js | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/api/sagas/objects.js b/src/api/sagas/objects.js deleted file mode 100644 index 98c766ec..00000000 --- a/src/api/sagas/objects.js +++ /dev/null @@ -1,24 +0,0 @@ -import {call, put, select} from "redux-saga/effects"; -import {addToStore} from "../../actions/objects"; -import {getSimulation} from "../routes/simulations"; -import {getUser} from "../routes/users"; - -const selectors = { - simulation: state => state.objects.simulation, - user: state => state.objects.user, - authorization: state => state.objects.authorization, -}; - -function* fetchAndStoreObject(objectType, id, apiCall) { - const objectStore = yield select(selectors[objectType]); - if (!objectStore[id]) { - const object = yield apiCall; - yield put(addToStore(objectType, object)); - } -} - -export const fetchAndStoreSimulation = (id) => - fetchAndStoreObject("simulation", id, call(getSimulation, id)); - -export const fetchAndStoreUser = (id) => - fetchAndStoreObject("user", id, call(getUser, id),); |
