Upstream sync
This commit is contained in:
812
package-lock.json
generated
812
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -33,8 +33,8 @@ const isFunction = (functionToCheck) => {
|
||||
};
|
||||
|
||||
const requireAuth = (nextState, replace, next) => {
|
||||
if (nextState.location.pathname === '/login' || nextState.location.pathname === '/sign-up' || nextState.location.pathname === '/selfRegister' || (nextState.location.pathname.indexOf('/ride') > -1 && nextState.params.ride_uuid !== undefined && nextState.params.user_uuid !== undefined)
|
||||
|| (!isFunction(replace) && (replace.location.pathname === '/login' || replace.location.pathname === '/sign-up' || nextState.location.pathname === '/selfRegister' || (replace.location.pathname.indexOf('/ride') > -1 && replace.params.ride_uuid !== undefined && replace.params.user_uuid !== undefined)))) {
|
||||
if (nextState.location.pathname === '/login' || nextState.location.pathname === '/sign-up' || nextState.location.pathname.toLowerCase() === '/selfregister' || (nextState.location.pathname.indexOf('/ride') > -1 && nextState.params.ride_uuid !== undefined && nextState.params.user_uuid !== undefined)
|
||||
|| (!isFunction(replace) && (replace.location.pathname === '/login' || replace.location.pathname === '/sign-up' || nextState.location.pathname.toLowerCase() === '/selfRegister' || (replace.location.pathname.indexOf('/ride') > -1 && replace.params.ride_uuid !== undefined && replace.params.user_uuid !== undefined)))) {
|
||||
next();
|
||||
}
|
||||
|
||||
|
||||
@@ -141,16 +141,20 @@ class SignUp extends React.Component {
|
||||
localStorage.removeItem('loggedUser');
|
||||
location.href = '/#/login';
|
||||
}).catch(function (err) {
|
||||
if (err.response.status === 422) {
|
||||
//Unprocessable Entity (validation failed)
|
||||
state.setState(Object.assign(state.state, {
|
||||
showValidationErrors: true,
|
||||
validationErrors: err.response.data.data
|
||||
}));
|
||||
} else {
|
||||
alert('Error to log in: ' + err.message);
|
||||
switch(err.response.status){
|
||||
case 422:
|
||||
//Unprocessable Entity (validation failed)
|
||||
state.setState(Object.assign(state.state, {
|
||||
showValidationErrors: true,
|
||||
validationErrors: err.response.data.data
|
||||
}));
|
||||
break;
|
||||
default:
|
||||
state.setState(Object.assign(state.state, {
|
||||
showValidationErrors: true,
|
||||
validationErrors: [{message:"Error processing your request"}]
|
||||
}));
|
||||
}
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user