return old endpoints

This commit is contained in:
smanylov
2025-12-12 12:06:59 +07:00
parent 6cbf5d421a
commit 0ce49ca364
+11 -19
View File
@@ -75,15 +75,11 @@ export async function authorization(
try { try {
const { email, password } = validatedFields.data; const { email, password } = validatedFields.data;
const response = await fetch(`${API_BASE_URL}/api/v1/data`, { const response = await fetch(`${API_BASE_URL}/v1/api/auth/login`, {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
version: 1, email: email,
msg_id: 20001, password: password
message_body: {
email: email,
password: password
}
}), }),
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@@ -92,7 +88,7 @@ export async function authorization(
}); });
if (response.ok) { if (response.ok) {
let parsed = await response.json(); let parsed = await response.json();
await createSession(parsed.message_body.token, email); await createSession(parsed.token, email);
} else { } else {
throw ('request-ended-with-an-error'); throw ('request-ended-with-an-error');
} }
@@ -179,18 +175,14 @@ export async function registration(
try { try {
const { full_name, email, password, phone } = validatedFields.data; const { full_name, email, password, phone } = validatedFields.data;
const response = await fetch(`${API_BASE_URL}/api/v1/data`, { const response = await fetch(`${API_BASE_URL}/v1/api/auth/register`, {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
version: 1, fullName: full_name,
msg_id: 20002, email,
message_body: { phone: phone,
fullName: full_name, password,
email, companyName: company,
phone: phone,
password,
companyName: company,
}
}), }),
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@@ -206,7 +198,7 @@ export async function registration(
let parsed = await response.json(); let parsed = await response.json();
console.log('--parsed--'); console.log('--parsed--');
console.log(parsed); console.log(parsed);
await createSession(parsed.message_body.token, email); await createSession(parsed.token, email);
} else { } else {
throw (`${response.status}`); throw (`${response.status}`);
} }