Skip to content

Commit

Permalink
feat(sessions): implement basic front end flow
Browse files Browse the repository at this point in the history
  • Loading branch information
brionmario committed Apr 18, 2019
1 parent 7f18de8 commit 20bf046
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/redux/actions/session-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
SET_SELECTED_CAMERA,
SET_CAMERA_CONNECTION_STATUS,
SET_SELECTED_APPLICATION,
INITIALIZE_SESSION
INITIALIZE_SESSION,
START_SESSION
} from '../types';
import {API_ENDPOINTS} from '../../api';
import {HttpInterceptor} from '../../services';
Expand All @@ -33,6 +34,13 @@ export const initializeSession = data => (dispatch) => {
});
};

export const startSession = data => (dispatch) => {
dispatch({
type: START_SESSION,
payload: data,
});
};

export const setSelectedApplication = app => (dispatch) => {
return dispatch({
type: SET_SELECTED_APPLICATION,
Expand Down
9 changes: 8 additions & 1 deletion src/redux/reducers/session-reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import {
SET_SELECTED_CAMERA,
SET_CAMERA_CONNECTION_STATUS,
SET_SELECTED_APPLICATION,
INITIALIZE_SESSION
INITIALIZE_SESSION,
START_SESSION
} from '../types';

const initialState = {
sessionTemp: {},
currentSession: {},
isSessionInitialized: false,
isSessionStarted: false,
questionnaires: [],
newQuestionnaire: {},
selectedApplication: {},
Expand All @@ -44,6 +46,11 @@ export function sessionReducer(state = initialState, action) {
sessionTemp: {},
currentSession: action.payload,
};
case START_SESSION:
return {
...state,
isSessionStarted: true,
};
case FETCH_QUESTIONNAIRES:
return {
...state,
Expand Down
3 changes: 2 additions & 1 deletion src/redux/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ export const SET_CAMERA_CONNECTION_STATUS = 'SET_CAMERA_CONNECTION_STATUS';
export const SET_RAW_PHONE_FEED_WS_DATA = 'SET_RAW_PHONE_FEED_WS_DATA';
export const SET_LIST_OF_AVAILABLE_CAMERAS = 'SET_LIST_OF_AVAILABLE_CAMERAS';
export const SET_SELECTED_CAMERA = 'SET_SELECTED_CAMERA';
export const INITIALIZE_SESSION = 'INITIALIZE_SESSION';
export const INITIALIZE_SESSION = 'INITIALIZE_SESSION';
export const START_SESSION = 'START_SESSION';

0 comments on commit 20bf046

Please sign in to comment.