blob: b824d8d56007d0d5f875246b5e3dafc1e6d90c6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import {call, put} from "redux-saga/effects";
import {addToAuthorizationStore, addToSimulationStore} from "../../actions/objects";
import {addSimulationSucceeded} from "../../actions/simulations";
import {addSimulation} from "../routes/simulations";
export function* onSimulationAdd(action) {
try {
const simulation = yield call(addSimulation, {name: action.name});
yield put(addToSimulationStore(simulation));
const authorization = {
simulationId: simulation.id,
userId: action.userId,
authorizationLevel: "OWN"
};
yield put(addToAuthorizationStore(authorization));
yield put(addSimulationSucceeded([authorization.userId, authorization.simulationId]));
} catch (error) {
console.log(error);
}
}
|