NCFRONT-17 change endpoints
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "no-copy-frontend",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 2999",
|
||||
|
||||
+12
-4
@@ -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({
|
||||
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({
|
||||
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}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user