redo navigation reducer to handle registration request with single action

This commit is contained in:
Ben Wheeler 2019-10-07 16:18:13 -04:00
parent ed99e410f5
commit d4676ec990

View file

@ -14,7 +14,8 @@ const Types = keyMirror({
SET_LOGIN_OPEN: null, SET_LOGIN_OPEN: null,
TOGGLE_LOGIN_OPEN: null, TOGGLE_LOGIN_OPEN: null,
SET_CANCELED_DELETION_OPEN: null, SET_CANCELED_DELETION_OPEN: null,
SET_REGISTRATION_OPEN: null SET_REGISTRATION_OPEN: null,
HANDLE_REGISTRATION_REQUESTED: null
}); });
module.exports.getInitialState = () => ({ module.exports.getInitialState = () => ({
@ -49,6 +50,12 @@ module.exports.navigationReducer = (state, action) => {
return defaults({canceledDeletionOpen: action.isOpen}, state); return defaults({canceledDeletionOpen: action.isOpen}, state);
case Types.SET_REGISTRATION_OPEN: case Types.SET_REGISTRATION_OPEN:
return defaults({registrationOpen: action.isOpen}, state); 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: default:
return state; return state;
} }
@ -92,9 +99,9 @@ module.exports.setSearchTerm = searchTerm => ({
searchTerm: searchTerm searchTerm: searchTerm
}); });
module.exports.navigateToRegistration = () => { module.exports.handleRegistrationRequested = () => ({
window.location = '/join'; type: Types.HANDLE_REGISTRATION_REQUESTED
}; });
module.exports.handleCompleteRegistration = createProject => (dispatch => { module.exports.handleCompleteRegistration = createProject => (dispatch => {
if (createProject) { if (createProject) {