diff --git a/src/app/actions/auth.ts b/src/app/actions/auth.ts index 71070a1..d431aa8 100644 --- a/src/app/actions/auth.ts +++ b/src/app/actions/auth.ts @@ -75,15 +75,11 @@ export async function authorization( try { 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', body: JSON.stringify({ - version: 1, - msg_id: 20001, - message_body: { - email: email, - password: password - } + email: email, + password: password }), headers: { "Content-Type": "application/json", @@ -92,7 +88,7 @@ export async function authorization( }); if (response.ok) { let parsed = await response.json(); - await createSession(parsed.message_body.token, email); + await createSession(parsed.token, email); } else { throw ('request-ended-with-an-error'); } @@ -179,18 +175,14 @@ export async function registration( try { 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', body: JSON.stringify({ - version: 1, - msg_id: 20002, - message_body: { - fullName: full_name, - email, - phone: phone, - password, - companyName: company, - } + fullName: full_name, + email, + phone: phone, + password, + companyName: company, }), headers: { "Content-Type": "application/json", @@ -206,7 +198,7 @@ export async function registration( let parsed = await response.json(); console.log('--parsed--'); console.log(parsed); - await createSession(parsed.message_body.token, email); + await createSession(parsed.token, email); } else { throw (`${response.status}`); }