export default defineEventHandler(async (event) => {
    const body = await readBody(event);
    const { public: { apiBase } } = useRuntimeConfig();
    const token = getCookie(event, 'token');
    try {
        const data = await $fetch(`${apiBase}/user/update`, {
            method: 'PUT',
            body: {
                avatarMedia: body.avatarMedia,
                name: body.name,
                lastName: "",
                userName: "",
                email: body.email,
                userName: body.userName
            },
            headers: {
                'Accept': 'application/json',
                'Authorization': `Bearer ${token}`
            }
        });
             return data;
    } catch (err) {
      return err
    }

})