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