From d4676ec99098bb7f00f51320194c3dab6ddcb581 Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Mon, 7 Oct 2019 16:18:13 -0400 Subject: [PATCH] redo navigation reducer to handle registration request with single action --- src/redux/navigation.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/redux/navigation.js b/src/redux/navigation.js index 591833208..46d945fc9 100644 --- a/src/redux/navigation.js +++ b/src/redux/navigation.js @@ -14,7 +14,8 @@ const Types = keyMirror({ SET_LOGIN_OPEN: null, TOGGLE_LOGIN_OPEN: null, SET_CANCELED_DELETION_OPEN: null, - SET_REGISTRATION_OPEN: null + SET_REGISTRATION_OPEN: null, + HANDLE_REGISTRATION_REQUESTED: null }); module.exports.getInitialState = () => ({ @@ -49,6 +50,12 @@ module.exports.navigationReducer = (state, action) => { return defaults({canceledDeletionOpen: action.isOpen}, state); case Types.SET_REGISTRATION_OPEN: return defaults({registrationOpen: action.isOpen}, state); + case Types.HANDLE_REGISTRATION_REQUESTED: + if (state.useScratch3Registration) { + window.location = '/join'; + return state; + } + return defaults({registrationOpen: true}, state); default: return state; } @@ -92,9 +99,9 @@ module.exports.setSearchTerm = searchTerm => ({ searchTerm: searchTerm }); -module.exports.navigateToRegistration = () => { - window.location = '/join'; -}; +module.exports.handleRegistrationRequested = () => ({ + type: Types.HANDLE_REGISTRATION_REQUESTED +}); module.exports.handleCompleteRegistration = createProject => (dispatch => { if (createProject) {