fix ui: make login error more consistent

This commit is contained in:
nick-delirium 2024-06-05 11:52:56 +02:00
parent 9753456e72
commit 453053179d
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0

View file

@ -58,7 +58,11 @@ const SignupForm: React.FC<SignupFormProps> = ({ tenants, errors, loading, signu
'g-recaptcha-response': token
}).then((resp: any) => {
if (resp && resp.errors && Array.isArray(resp.errors) && resp.errors.length > 0) {
resp.errors[0] ? toast.error(resp.errors[0]) : toast.error('Something went wrong');
if ((resp.errors[0] as string).includes('in use')) {
toast.error("This email is already linked to an account or team on OpenReplay and can't be used again.")
} else {
resp.errors[0] ? toast.error(resp.errors[0]) : toast.error('Something went wrong');
}
}
});
setState({ ...state, reload: true });