mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-19 16:07:32 -03:00
fix: ahora esa api usa un formData
This commit is contained in:
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user