diff options
| author | Georgios Andreadis <G.Andreadis@student.tudelft.nl> | 2017-10-04 23:23:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-04 23:23:09 +0200 |
| commit | fcaaae65d34003874c76e0c01134dedf94248e09 (patch) | |
| tree | 2aae1422168651e832a1904623f6f5b100fc17ec /src/sagas/simulations.js | |
| parent | 0a62dfb55c5700013d42a589b930c7448e5bff71 (diff) | |
| parent | 606d1de0be09f3597165248f65d54e158a13860c (diff) | |
Merge pull request #42 from atlarge-research/auto-reformat
Standardize code format
Diffstat (limited to 'src/sagas/simulations.js')
| -rw-r--r-- | src/sagas/simulations.js | 71 |
1 files changed, 40 insertions, 31 deletions
diff --git a/src/sagas/simulations.js b/src/sagas/simulations.js index cf0358f9..9df4e4b5 100644 --- a/src/sagas/simulations.js +++ b/src/sagas/simulations.js @@ -1,42 +1,51 @@ -import {call, put} from "redux-saga/effects"; -import {addToStore} from "../actions/objects"; -import {addSimulationSucceeded, deleteSimulationSucceeded} from "../actions/simulations"; -import {addSimulation, deleteSimulation, getSimulation} from "../api/routes/simulations"; -import {fetchLatestDatacenter} from "./topology"; +import { call, put } from "redux-saga/effects"; +import { addToStore } from "../actions/objects"; +import { + addSimulationSucceeded, + deleteSimulationSucceeded +} from "../actions/simulations"; +import { + addSimulation, + deleteSimulation, + getSimulation +} from "../api/routes/simulations"; +import { fetchLatestDatacenter } from "./topology"; export function* onOpenSimulationSucceeded(action) { - try { - const simulation = yield call(getSimulation, action.id); - yield put(addToStore("simulation", simulation)); + try { + const simulation = yield call(getSimulation, action.id); + yield put(addToStore("simulation", simulation)); - yield fetchLatestDatacenter(action.id); - } catch (error) { - console.error(error); - } + yield fetchLatestDatacenter(action.id); + } catch (error) { + console.error(error); + } } export function* onSimulationAdd(action) { - try { - const simulation = yield call(addSimulation, {name: action.name}); - yield put(addToStore("simulation", simulation)); + try { + const simulation = yield call(addSimulation, { name: action.name }); + yield put(addToStore("simulation", simulation)); - const authorization = { - simulationId: simulation.id, - userId: action.userId, - authorizationLevel: "OWN" - }; - yield put(addToStore("authorization", authorization)); - yield put(addSimulationSucceeded([authorization.userId, authorization.simulationId])); - } catch (error) { - console.error(error); - } + const authorization = { + simulationId: simulation.id, + userId: action.userId, + authorizationLevel: "OWN" + }; + yield put(addToStore("authorization", authorization)); + yield put( + addSimulationSucceeded([authorization.userId, authorization.simulationId]) + ); + } catch (error) { + console.error(error); + } } export function* onSimulationDelete(action) { - try { - yield call(deleteSimulation, action.id); - yield put(deleteSimulationSucceeded(action.id)); - } catch (error) { - console.error(error); - } + try { + yield call(deleteSimulation, action.id); + yield put(deleteSimulationSucceeded(action.id)); + } catch (error) { + console.error(error); + } } |
