Files
2024-07-01 23:09:43 +03:30

20 lines
542 B
JavaScript

export default defineEventHandler(async (event) => {
const { public: { apiBase } } = useRuntimeConfig();
const token = getCookie(event, 'token');
const query = getQuery(event);
try {
const data = await $fetch(`${apiBase}/uploader/file?fileName=${query.fileName}`, {
method: 'GET',
headers: {
'Accept': 'application/json',
'Authorization': `Bearer ${token}`
}
});
return data;
} catch (error) {
return error;
}
});