fix: ahora esa api usa un formData

This commit is contained in:
2025-12-03 15:01:20 -03:00
parent 7482e0eb3d
commit 24e37550ba

View File

@@ -23,21 +23,18 @@
async function handlePost(e: Event) { async function handlePost(e: Event) {
e.preventDefault(); e.preventDefault();
try { try {
const data: CreatePostDto = { const formData = new FormData();
content: mensaje, formData.append('content', mensaje);
imageUrl: null, // formData.append('imageUrl', '');
parentPostId: null // formData.append('parentPostId', '');
};
const req = fetch($apiBase + '/api/posts', { const req = fetch($apiBase + '/api/posts', {
method: 'POST', method: 'POST',
//credentials: 'include', //credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${$sesionStore?.accessToken}` Authorization: `Bearer ${$sesionStore?.accessToken}`
}, },
body: formData
body: JSON.stringify(data)
}); });
cargando = true; cargando = true;