diff --git a/package.json b/package.json index 1d02bd3..9f7fce6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "no-copy-frontend", - "version": "0.3.0", + "version": "0.4.0", "private": true, "scripts": { "dev": "next dev -p 2999", diff --git a/src/app/actions/auth.ts b/src/app/actions/auth.ts index d431aa8..71070a1 100644 --- a/src/app/actions/auth.ts +++ b/src/app/actions/auth.ts @@ -75,11 +75,15 @@ export async function authorization( try { const { email, password } = validatedFields.data; - const response = await fetch(`${API_BASE_URL}/v1/api/auth/login`, { + const response = await fetch(`${API_BASE_URL}/api/v1/data`, { method: 'POST', body: JSON.stringify({ - email: email, - password: password + version: 1, + msg_id: 20001, + message_body: { + email: email, + password: password + } }), headers: { "Content-Type": "application/json", @@ -88,7 +92,7 @@ export async function authorization( }); if (response.ok) { let parsed = await response.json(); - await createSession(parsed.token, email); + await createSession(parsed.message_body.token, email); } else { throw ('request-ended-with-an-error'); } @@ -175,14 +179,18 @@ 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}/api/v1/data`, { method: 'POST', body: JSON.stringify({ - fullName: full_name, - email, - phone: phone, - password, - companyName: company, + version: 1, + msg_id: 20002, + message_body: { + fullName: full_name, + email, + phone: phone, + password, + companyName: company, + } }), headers: { "Content-Type": "application/json", @@ -198,7 +206,7 @@ export async function registration( let parsed = await response.json(); console.log('--parsed--'); console.log(parsed); - await createSession(parsed.token, email); + await createSession(parsed.message_body.token, email); } else { throw (`${response.status}`); }