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