refactor tokens

This commit is contained in:
smanylov
2026-06-01 14:48:13 +07:00
parent d7d2e36573
commit 743db57bb3
11 changed files with 105 additions and 127 deletions
+7 -10
View File
@@ -72,7 +72,7 @@ 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}/api/auth`, {
method: 'POST',
body: JSON.stringify({
version: 1,
@@ -234,7 +234,7 @@ export async function registration(
try {
const { fullName, email, password, phone } = validatedFields.data;
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
const response = await fetch(`${API_BASE_URL}/api/auth`, {
method: 'POST',
body: JSON.stringify({
version: 1,
@@ -400,13 +400,11 @@ export async function tokenLifeExtension() {
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${token}`,
},
body: JSON.stringify({
version: 1,
msg_id: 20008,
message_body: {
token: token
}
msg_id: 20008
}),
});
@@ -431,14 +429,14 @@ export async function confirmEmail(userId: number, verifyToken: string) {
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
'Authorization': `Bearer ${verifyToken}`,
},
body: JSON.stringify({
version: 1,
msg_id: 20009,
message_body: {
resend: 0,
user_id: userId,
verify_token: verifyToken
user_id: userId
}
}),
});
@@ -474,7 +472,6 @@ export async function confirmEmail(userId: number, verifyToken: string) {
export async function resendConfirmEmail(userId: number) {
console.log('resendConfirmEmail');
try {
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
method: 'POST',
@@ -611,6 +608,7 @@ export async function confirmPassword(
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${verifyToken}`
},
body: JSON.stringify({
version: 1,
@@ -618,7 +616,6 @@ export async function confirmPassword(
message_body: {
email: email,
password: password,
verifyToken: verifyToken,
action: "confirmVerification"
}
}),