fix auth errors and add tracker-registration

This commit is contained in:
Mikola
2024-03-11 18:24:18 +03:00
parent 2ed0be6664
commit 176dd29625
2 changed files with 17 additions and 20 deletions

View File

@ -87,22 +87,23 @@ export const useFormValidation = (
e.preventDefault();
// Проверка валидации формы
if (validateForm()) {
setLoader(true)
setLoader(true);
let newformData = { ...formData, is_partner: isPartner ? 1 : 0 };
delete newformData.secondPassword;
try {
apiRequest(apiEndpoint, {
method: "POST",
data: newformData
}).then((data) => {
setLoader(false)
setLoader(false);
if ("errors" in data) {
return showNotificationError('Аккаунт с таким логином или email уже существуе');
return showNotificationError(
"Аккаунт с таким логином или email уже существуе"
);
}
if (!data.id) {
return showNotificationError('Ошибка');
return showNotificationError("Ошибка");
}
handleClearForm();
showNotificationTrue();