mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-19 16:07:32 -03:00
modificado el nombre del like post
This commit is contained in:
@@ -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--;
|
||||||
|
|||||||
@@ -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',
|
||||||
Reference in New Issue
Block a user