add file preview and download file

This commit is contained in:
smanylov
2026-05-27 12:56:13 +07:00
parent b61d6527c4
commit df82b7e451
10 changed files with 178 additions and 46 deletions
+3 -18
View File
@@ -5,16 +5,6 @@ import { API_BASE_URL } from '@/app/actions/definitions';
export async function fetchModerationContentList(page?: number, size?: number, sortBy?: string, sortDirection?: 'asc' | 'desc' | string) {
const token = await getSessionData('token');
console.log('fetchModerationContentList');
/* console.log(
{
action: 'files_for_moderation',
page: page,
page_size: size,
sort_by: sortBy || '',
sort_direction: sortDirection || 'asc',
}
) */
try {
const response = await fetch(`${API_BASE_URL}/api/admin/info`, {
@@ -26,11 +16,8 @@ export async function fetchModerationContentList(page?: number, size?: number, s
action: 'files_for_moderation',
page: page,
page_size: size,
/* sort_by: sortBy || '',
sort_order: sortDirection || 'asc', */
/* full_name: nameQuery, */
/* fileName: '',
userId: '' */
sort_by: sortBy || '',
sort_order: sortDirection || 'asc',
}
}),
headers: {
@@ -42,7 +29,6 @@ export async function fetchModerationContentList(page?: number, size?: number, s
if (response.ok) {
const parsed = await response.json();
console.log(parsed);
if (parsed.message_code === 0) {
return parsed.message_body.message_body;
@@ -60,10 +46,9 @@ export async function fetchModerationContentList(page?: number, size?: number, s
export async function changeModerationContentStatus(fileId?: string, fileStatus?: string) {
const token = await getSessionData('token');
console.log(`changeModerationContentStatus - ${fileId} - ${fileStatus}`);
try {
const response = await fetch(`${API_BASE_URL}/api/admin/info`, {
const response = await fetch(`${API_BASE_URL}/api/admin/control`, {
method: 'POST',
body: JSON.stringify({
version: 1,