fix download url
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use server'
|
||||
|
||||
import { getSessionData } from '@/app/actions/session';
|
||||
import { API_BASE_URL, API_DASHBOARD_URL } from '@/app/actions/definitions';
|
||||
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');
|
||||
@@ -86,20 +86,13 @@ export async function changeModerationContentStatus(fileId?: string, fileStatus?
|
||||
|
||||
export async function downloadFile(fileId: string, fileName: string) {
|
||||
const token = await getSessionData('token');
|
||||
console.log('downloadFile');
|
||||
|
||||
/* ${API_DASHBOARD_URL} */
|
||||
/* ${API_BASE_URL} */
|
||||
const response = await fetch(`${API_DASHBOARD_URL}/api/v1/files/download/${fileId}`, {
|
||||
const response = await fetch(`${API_BASE_URL}/api/admin/download/${fileId}`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
|
||||
/* console.log(response); */
|
||||
const text = await response.text();
|
||||
console.log(text);
|
||||
|
||||
if (!response.ok) {
|
||||
throw 'failed-to-download-file';
|
||||
}
|
||||
@@ -127,7 +120,7 @@ export async function fetchAppealsContentList(page?: number, size?: number, sort
|
||||
action: 'all_appeals',
|
||||
page: page,
|
||||
page_size: size,
|
||||
/* sort_by: sortDirection || 'asc',
|
||||
/* sort_by: sortDirection || 'asc',
|
||||
sort_order: sortBy || '', */
|
||||
}
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user