mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-30 02:56:20 -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,
|
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) {
|
||||||
|
|
Loading…
Reference in a new issue