modificado el nombre del like post

This commit is contained in:
2025-12-02 20:26:02 -03:00
parent 4ba91dae21
commit 94d967ca77
2 changed files with 3 additions and 3 deletions

View File

@@ -29,7 +29,7 @@
import DialogTitle from './ui/dialog/dialog-title.svelte'; import DialogTitle from './ui/dialog/dialog-title.svelte';
import DialogDescription from './ui/dialog/dialog-description.svelte'; import DialogDescription from './ui/dialog/dialog-description.svelte';
import { sesionStore } from '@/stores/usuario'; import { sesionStore } from '@/stores/usuario';
import { likePublicacion } from '@/hooks/likePublicacion'; import { likePost } from '@/hooks/likePost';
interface postProp { interface postProp {
post: Post; post: Post;
@@ -61,7 +61,7 @@
async function likeHandler() { async function likeHandler() {
cargandoLike = true; cargandoLike = true;
let { message, ok } = await likePublicacion(post); let { message, ok } = await likePost(post);
if (ok) { if (ok) {
if (post.isLiked) { if (post.isLiked) {
post.likesCount--; post.likesCount--;

View File

@@ -3,7 +3,7 @@ import { get } from 'svelte/store';
import { sesionStore } from '@/stores/usuario'; import { sesionStore } from '@/stores/usuario';
import type { Post } from '../../types'; import type { Post } from '../../types';
export async function likePublicacion(post: Post) { export async function likePost(post: Post) {
try { try {
const req = await fetch(get(apiBase) + `/api/posts/${post.id}/like`, { const req = await fetch(get(apiBase) + `/api/posts/${post.id}/like`, {
method: post.isLiked ? 'DELETE' : 'POST', method: post.isLiked ? 'DELETE' : 'POST',