Upstream sync

This commit is contained in:
Senad Uka
2018-05-31 18:24:49 +02:00
parent 04debaf3e9
commit 182cde9fbb
3 changed files with 778 additions and 60 deletions

812
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -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();
}

View File

@@ -141,16 +141,20 @@ class SignUp extends React.Component {
localStorage.removeItem('loggedUser');
location.href = '/#/login';
}).catch(function (err) {
if (err.response.status === 422) {
switch(err.response.status){
case 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);
break;
default:
state.setState(Object.assign(state.state, {
showValidationErrors: true,
validationErrors: [{message:"Error processing your request"}]
}));
}
console.error(err);
});
}