summaryrefslogtreecommitdiff
path: root/src/actions/simulations.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions/simulations.js')
-rw-r--r--src/actions/simulations.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/actions/simulations.js b/src/actions/simulations.js
new file mode 100644
index 00000000..314a2492
--- /dev/null
+++ b/src/actions/simulations.js
@@ -0,0 +1,58 @@
+export const SET_AUTH_VISIBILITY_FILTER = "SET_AUTH_VISIBILITY_FILTER";
+export const OPEN_NEW_SIMULATION_MODAL = "OPEN_NEW_SIMULATION_MODAL";
+export const CLOSE_NEW_SIMULATION_MODAL = "CLOSE_SIMULATION_POPUP";
+export const ADD_SIMULATION = "ADD_SIMULATION";
+export const ADD_SIMULATION_SUCCEEDED = "ADD_SIMULATION_SUCCEEDED";
+export const DELETE_SIMULATION = "DELETE_SIMULATION";
+export const OPEN_SIMULATION = "OPEN_SIMULATION";
+
+export function setAuthVisibilityFilter(filter) {
+ return {
+ type: SET_AUTH_VISIBILITY_FILTER,
+ filter: filter
+ };
+}
+
+export function openNewSimulationModal() {
+ return {
+ type: OPEN_NEW_SIMULATION_MODAL
+ };
+}
+
+export function closeNewSimulationModal() {
+ return {
+ type: CLOSE_NEW_SIMULATION_MODAL
+ };
+}
+
+export function addSimulation(name) {
+ return (dispatch, getState) => {
+ const {auth} = getState();
+ dispatch({
+ type: ADD_SIMULATION,
+ name,
+ userId: auth.userId
+ });
+ };
+}
+
+export function addSimulationSucceeded(authorization) {
+ return {
+ type: ADD_SIMULATION_SUCCEEDED,
+ authorization
+ };
+}
+
+export function deleteSimulation(id) {
+ return {
+ type: DELETE_SIMULATION,
+ id
+ };
+}
+
+export function openSimulation(id) {
+ return {
+ type: OPEN_SIMULATION,
+ id
+ };
+}