add check modal window

This commit is contained in:
smanylov
2026-01-28 18:53:08 +07:00
parent a6a493fe97
commit c4ab78b89b
13 changed files with 318 additions and 67 deletions
+7 -7
View File
@@ -9,7 +9,7 @@ export async function getUserData() {
const token = await getSessionData('token');
/* для теста */
if (userEmail === "test" && token === "1111") {
if (userEmail === 'test' && token === '1111') {
return testUserData;
}
/* для теста */
@@ -18,9 +18,9 @@ export async function getUserData() {
const response = await fetch(`${API_BASE_URL}/v1/api/user?email=${userEmail}`, {
method: 'GET',
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${token}`,
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${token}`,
}
});
@@ -42,13 +42,13 @@ export async function getUserFilesInfo() {
version: 1,
msg_id: 20005,
message_body: {
action: "user_files_info",
action: 'user_files_info',
token: token
}
}),
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
+11 -11
View File
@@ -11,9 +11,9 @@ export async function logout() {
await fetch(`${API_BASE_URL}/v1/api/auth/logout`, {
method: 'POST',
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": `Bearer ${token}`,
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${token}`,
}
});
} catch (error) {
@@ -36,8 +36,8 @@ export async function authorization(
const password = formData.get('password');
/* для теста */
if (email === "test" && password === "test") {
await createSession("1111", "test");
if (email === 'test' && password === 'test') {
await createSession('1111', 'test');
redirect('/pages/dashboard');
}
/* для теста */
@@ -81,8 +81,8 @@ export async function authorization(
}
}),
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
if (response.ok) {
@@ -211,8 +211,8 @@ export async function registration(
}
}),
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
@@ -302,8 +302,8 @@ export async function tokenLifeExtension() {
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
method: 'POST',
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({
version: 1,
+1 -1
View File
@@ -1,5 +1,5 @@
import * as z from 'zod'
import { createValidationSchema } from "@/app/lib/validation-config-parser";
import { createValidationSchema } from '@/app/lib/validation-config-parser';
import validationConfig from '@/app/lib/validation-config.json';
export type FormState =
+44 -6
View File
@@ -21,8 +21,8 @@ export async function getUserFilesData(page: number, pageSize: number) {
}
}),
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
@@ -59,8 +59,8 @@ export async function removeUserFile(fileId: string, fullDelete: number) {
}
}),
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
@@ -120,8 +120,46 @@ export async function searchGlobalFiles(fileId: string) {
}
}),
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
if (response.ok) {
let parsed = await response.json();
if (parsed.message_code === 0) {
return parsed.message_body;
} else {
throw parsed;
}
} else {
throw (`${response.status}`);
}
} catch (error) {
return error
}
}
export async function viewFileInfo(fileId: string) {
const token = await getSessionData('token');
try {
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
method: 'POST',
body: JSON.stringify({
version: 1,
msg_id: 20005,
message_body: {
action: 'file_info',
file_id: fileId,
token: token
}
}),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
+10 -10
View File
@@ -18,7 +18,7 @@ export async function fileUpload(messageBody: initMessageBody) {
return;
}
const message = messageBody;
message.action = "init";
message.action = 'init';
message.token = token;
try {
@@ -30,8 +30,8 @@ export async function fileUpload(messageBody: initMessageBody) {
message_body: message
}),
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
@@ -68,13 +68,13 @@ export async function cancelUpload(udloadId: string) {
version: 1,
msg_id: 20004,
message_body: {
action: "cancel",
action: 'cancel',
upload_id: udloadId,
}
}),
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
@@ -138,8 +138,8 @@ export async function checkChunkStatus(upload_id: string) {
}
}),
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
@@ -173,8 +173,8 @@ export async function getAllowedFilesExtensions(type: string) {
}
}),
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
+2 -2
View File
@@ -15,8 +15,8 @@ export async function vkAuthorization(data : any, codeVerifier: string) {
const response = await fetch(`${API_BASE_URL}/api/v1/vk/authorization/${code}/${state}/${codeVerifier}/${device_id}`, {
method: 'GET',
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
if (response.ok) {
+2 -2
View File
@@ -15,8 +15,8 @@ export async function YandexAuthorization(data: any, codeVerifier: string) {
const response = await fetch(`${API_BASE_URL}/api/v1/yandex/authorization/${code}/${state}/${codeVerifier}/${device_id}`, {
method: 'GET',
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
if (response.ok) {