update watch dock info endpoint
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "no-copy-frontend",
|
"name": "no-copy-frontend",
|
||||||
"version": "0.121.0",
|
"version": "0.122.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 2999",
|
"dev": "next dev -p 2999",
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ interface DocumentInfo {
|
|||||||
updatedAt?: string;
|
updatedAt?: string;
|
||||||
uploadSessionId?: string;
|
uploadSessionId?: string;
|
||||||
userId?: number;
|
userId?: number;
|
||||||
|
appealInfos?: any[]; //Не знаю что тут будет
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function Page({ searchParams }: PageProps) {
|
export default async function Page({ searchParams }: PageProps) {
|
||||||
|
|||||||
@@ -91,18 +91,11 @@ export async function requestFileAsBuffer(fileId: string): Promise<ArrayBuffer |
|
|||||||
|
|
||||||
export async function fetchDocumentInfo(fileId: string) {
|
export async function fetchDocumentInfo(fileId: string) {
|
||||||
const token = await getSessionData('token');
|
const token = await getSessionData('token');
|
||||||
|
console.log('fetchDocumentInfo');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
const response = await fetch(`${API_BASE_URL}/api/files/public/file-info/${fileId}`, {
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
body: JSON.stringify({
|
|
||||||
version: 1,
|
|
||||||
msg_id: 20005,
|
|
||||||
message_body: {
|
|
||||||
file_id: fileId,
|
|
||||||
action: 'file_info'
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': `Bearer ${token}`
|
'Authorization': `Bearer ${token}`
|
||||||
@@ -111,13 +104,7 @@ export async function fetchDocumentInfo(fileId: string) {
|
|||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const parsed = await response.json();
|
const parsed = await response.json();
|
||||||
|
return parsed;
|
||||||
if (parsed.message_code === 0) {
|
|
||||||
return parsed.message_body;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`${response.status}`);
|
throw new Error(`${response.status}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user