Handle native GraphQLErrors
This commit is contained in:
parent
b2d8c374c0
commit
59d5376f60
|
|
@ -103,22 +103,22 @@ export default {
|
||||||
if (localLogin.success) {
|
if (localLogin.success) {
|
||||||
const redirectUrl = that.$route.query.redirect ? that.$route.query.redirect : '/'
|
const redirectUrl = that.$route.query.redirect ? that.$route.query.redirect : '/'
|
||||||
that.$router.push(redirectUrl);
|
that.$router.push(redirectUrl);
|
||||||
} else {
|
|
||||||
const firstError = localLogin.errors[0];
|
|
||||||
switch (firstError.field) {
|
|
||||||
case 'invalid_credentials':
|
|
||||||
that.loginError = 'Die E-Mail oder das Passwort ist falsch. Bitte versuchen Sie nochmals.';
|
|
||||||
break;
|
|
||||||
case 'license_inactive':
|
|
||||||
that.loginError = 'Ihre Lizenz ist nicht mehr aktiv.';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
that.loginError = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie nochmals.';
|
that.loginError = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie nochmals.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
const firstError = error.graphQLErrors[0];
|
||||||
|
switch (firstError.message) {
|
||||||
|
case 'invalid_credentials':
|
||||||
|
that.loginError = 'Die E-Mail oder das Passwort ist falsch. Bitte versuchen Sie nochmals.';
|
||||||
|
break;
|
||||||
|
case 'license_inactive':
|
||||||
|
that.loginError = 'Ihre Lizenz ist nicht mehr aktiv.';
|
||||||
|
break;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -95,22 +95,23 @@ export default {
|
||||||
const redirectUrl = that.$route.query.redirect ? that.$route.query.redirect : '/';
|
const redirectUrl = that.$route.query.redirect ? that.$route.query.redirect : '/';
|
||||||
that.$router.push(redirectUrl);
|
that.$router.push(redirectUrl);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
const firstError = login.errors[0];
|
|
||||||
switch (firstError.field) {
|
|
||||||
case 'invalid_credentials':
|
|
||||||
that.loginError = 'Die E-Mail oder das Passwort ist falsch. Bitte versuchen Sie nochmals.';
|
|
||||||
break;
|
|
||||||
case 'no_valid_license':
|
|
||||||
this.$router.push({name: 'licenseActivation'})
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
that.loginError = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie nochmals.';
|
that.loginError = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie nochmals.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.catch(errors => {
|
||||||
|
const firstError = errors.graphQLErrors[0];
|
||||||
|
switch (firstError.message) {
|
||||||
|
case 'invalid_credentials':
|
||||||
|
that.loginError = 'Die E-Mail oder das Passwort ist falsch. Bitte versuchen Sie nochmals.';
|
||||||
|
break;
|
||||||
|
case 'no_valid_license':
|
||||||
|
this.$router.push({name: 'licenseActivation'})
|
||||||
|
break;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
resetForm() {
|
resetForm() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue