mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-26 17:16:11 -05:00
redo navigation reducer to handle registration request with single action
This commit is contained in:
parent
ed99e410f5
commit
d4676ec990
1 changed files with 11 additions and 4 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue