Merge pull request 'NCFRONT-17 change endpoints' (#3) from NCFRONT-17 into main

Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
2025-12-17 14:29:11 +08:00
2 changed files with 20 additions and 12 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "no-copy-frontend",
"version": "0.3.0",
"version": "0.4.0",
"private": true,
"scripts": {
"dev": "next dev -p 2999",
+19 -11
View File
@@ -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}`);
}