import { readFiles } from 'h3-formidable'
import FormData from 'form-data';
import fs from 'fs';
export default defineEventHandler(async (event) => {
    const { public: { apiBase } } = useRuntimeConfig();
    const token = getCookie(event, 'token');


    const formData = await readFormData(event);
 


    try {
        const data = await $fetch(`${apiBase}/uploader`, {
            method: 'POST',
            body: formData,
            headers: {
                'Accept': 'application/json',
                'Authorization': `Bearer ${token}`
            },
        });

        return data;
    } catch (error) {

        return error;
    }

})