make translate for login, register pages

This commit is contained in:
smanylov
2025-12-10 16:39:13 +07:00
parent d9c26b079d
commit f281c13f87
31 changed files with 830 additions and 103 deletions
+5 -5
View File
@@ -83,7 +83,7 @@ export async function authorization(
let parsed = await response.json();
await createSession(parsed.token, parsed.email);
} else {
throw (`Запрос завершился с ошибкой: ${response.status}`);
throw ('request-ended-with-an-error');
}
} catch (error) {
@@ -146,7 +146,7 @@ export async function registration(
path: string
}) => {
if (errors[obj.path[0]]) {
errors[obj.path[0]] = `${errors[obj.path[0]]} ${obj.message}`;
errors[obj.path[0]] = `${errors[obj.path[0]]}&${obj.message}`;
} else {
errors[obj.path[0]] = obj.message;
}
@@ -168,9 +168,9 @@ export async function registration(
try {
const { full_name, email, password, phone } = validatedFields.data;
const response = await fetch(`${API_BASE_URL}/v1/api/auth/register`, {
const response = await fetch(`${API_BASE_URL}/v1/api/auth/register1`, {
method: 'POST',
body: JSON.stringify({ fullName: full_name, email, password, companyName: company, phone: phone}),
body: JSON.stringify({ fullName: full_name, email, password, companyName: company, phone: phone }),
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
@@ -186,7 +186,7 @@ export async function registration(
} catch (error) {
if (error) {
const errors: Record<string, string> = {};
errors['server'] = `Запрос завершился с ошибкой: ${error}`
errors['server'] = 'request-ended-with-an-error'
return {
previousState: {