diff options
Diffstat (limited to 'src/actions')
| -rw-r--r-- | src/actions/auth.js | 20 | ||||
| -rw-r--r-- | src/actions/object-stores.js | 24 | ||||
| -rw-r--r-- | src/actions/projects.js | 24 | ||||
| -rw-r--r-- | src/actions/users.js | 19 |
4 files changed, 69 insertions, 18 deletions
diff --git a/src/actions/auth.js b/src/actions/auth.js index f54563ae..2ca6a986 100644 --- a/src/actions/auth.js +++ b/src/actions/auth.js @@ -1,15 +1,23 @@ -export const COMPLETE_LOGIN = "COMPLETE_LOGIN"; +export const LOG_IN = "LOG_IN"; +export const LOG_IN_SUCCEEDED = "LOG_IN_SUCCEEDED"; export const LOG_OUT = "LOG_OUT"; -export const completeLogin = (payload) => { +export function logIn(payload) { return { - type: COMPLETE_LOGIN, + type: LOG_IN, payload }; -}; +} -export const logOut = () => { +export function logInSucceeded(payload) { + return { + type: LOG_IN_SUCCEEDED, + payload + }; +} + +export function logOut() { return { type: LOG_OUT }; -}; +} diff --git a/src/actions/object-stores.js b/src/actions/object-stores.js new file mode 100644 index 00000000..08f3f0bd --- /dev/null +++ b/src/actions/object-stores.js @@ -0,0 +1,24 @@ +export const ADD_TO_SIMULATION_STORE = "ADD_TO_SIMULATION_STORE"; +export const ADD_TO_AUTHORIZATION_STORE = "ADD_TO_AUTHORIZATION_STORE"; +export const ADD_TO_USER_STORE = "ADD_TO_USER_STORE"; + +export function addToSimulationStore(simulation) { + return { + type: ADD_TO_SIMULATION_STORE, + simulation + }; +} + +export function addToAuthorizationStore(authorization) { + return { + type: ADD_TO_AUTHORIZATION_STORE, + authorization + }; +} + +export function addToUserStore(user) { + return { + type: ADD_TO_USER_STORE, + user + } +} diff --git a/src/actions/projects.js b/src/actions/projects.js index 0ab1f820..efbd15e9 100644 --- a/src/actions/projects.js +++ b/src/actions/projects.js @@ -5,42 +5,42 @@ export const ADD_PROJECT = "ADD_PROJECT"; export const DELETE_PROJECT = "DELETE_PROJECT"; export const OPEN_PROJECT = "OPEN_PROJECT"; -export const setAuthVisibilityFilter = (filter) => { +export function setAuthVisibilityFilter(filter) { return { type: SET_AUTH_VISIBILITY_FILTER, filter: filter }; -}; +} -export const openNewProjectModal = () => { +export function openNewProjectModal() { return { type: OPEN_NEW_PROJECT_MODAL }; -}; +} -export const closeNewProjectModal = () => { +export function closeNewProjectModal() { return { type: CLOSE_NEW_PROJECT_MODAL }; -}; +} -export const addProject = (name) => { +export function addProject(name) { return { type: ADD_PROJECT, name }; -}; +} -export const deleteProject = (id) => { +export function deleteProject(id) { return { type: DELETE_PROJECT, id }; -}; +} -export const openProject = (id) => { +export function openProject(id) { return { type: OPEN_PROJECT, id }; -}; +} diff --git a/src/actions/users.js b/src/actions/users.js new file mode 100644 index 00000000..093adddd --- /dev/null +++ b/src/actions/users.js @@ -0,0 +1,19 @@ +export const FETCH_AUTHORIZATIONS_OF_CURRENT_USER = "FETCH_AUTHORIZATIONS_OF_CURRENT_USER"; +export const FETCH_AUTHORIZATIONS_OF_CURRENT_USER_SUCCEEDED = "FETCH_AUTHORIZATIONS_OF_CURRENT_USER_SUCCEEDED"; + +export function fetchAuthorizationsOfCurrentUser() { + return (dispatch, getState) => { + const {auth} = getState(); + dispatch({ + type: FETCH_AUTHORIZATIONS_OF_CURRENT_USER, + userId: auth.userId + }); + }; +} + +export function fetchAuthorizationsOfCurrentUserSucceeded(authorizationsOfCurrentUser) { + return { + type: FETCH_AUTHORIZATIONS_OF_CURRENT_USER_SUCCEEDED, + authorizationsOfCurrentUser + }; +} |
