diff --git a/src/lib/hooks/likePost.ts b/src/lib/hooks/likePost.ts index 0da0e7e..a16787c 100644 --- a/src/lib/hooks/likePost.ts +++ b/src/lib/hooks/likePost.ts @@ -4,9 +4,10 @@ import { sesionStore } from '@/stores/usuario'; import type { Post } from '../../types'; export async function likePost(post: Post) { + let method = post.isLiked ? "DELETE" : "POST"; try { const req = await fetch(get(apiBase) + `/api/posts/${post.id}/like`, { - method: post.isLiked ? 'DELETE' : 'POST', + method: method, headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${get(sesionStore)?.accessToken}`