diff --git a/src/lib/components/BotonSeguir.svelte b/src/lib/components/BotonSeguir.svelte index 2a083b3..e1eee23 100644 --- a/src/lib/components/BotonSeguir.svelte +++ b/src/lib/components/BotonSeguir.svelte @@ -11,7 +11,7 @@ import { seguirUsuario } from '@/hooks/seguirUsuario'; import type { Post } from '../../types'; import CardError from './CardError.svelte'; - import { cacheSeguidos } from '@/stores/cacheSeguidos.svelte'; + import { cacheSeguidos } from '@/stores/cacheSeguidos.js'; let { post, @@ -41,16 +41,13 @@ }); async function cargarSeguido() { - let a = cacheSeguidos.get(post.authorId); - if (a === undefined) { - const seguidoStatus = await esSeguido(post as Post); - if (seguidoStatus) { - cacheSeguidos.set(post.authorId, seguidoStatus.isFollowing || false); - seguido = seguidoStatus.isFollowing || false; + seguido = await cacheSeguidos.getOrFetch( + post.authorId, + async () => { + const seguidoStatus = await esSeguido(post as Post); + return seguidoStatus?.isFollowing || false; } - return; - } - seguido = a; + ); } let mensajeError: string | null = $state(null); diff --git a/src/lib/components/TablaUsuarios.svelte b/src/lib/components/TablaUsuarios.svelte index fb67d66..27f6c8d 100644 --- a/src/lib/components/TablaUsuarios.svelte +++ b/src/lib/components/TablaUsuarios.svelte @@ -92,26 +92,6 @@ return sortDirection === 'asc' ? '↑' : '↓'; } - function handleCambiarContraseña(usuario: UserResponseDto) { - open = true; - usuarioCambioPass = usuario; - } - - function handleModificar(usuario: UserResponseDto) { - openModificarUsuario = true; - usuarioModificar = usuario; - } - - function handleBorrar(usuario: UserResponseDto) { - openBorrar = true; - usuarioBorrar = usuario; - } - - function handleDarAdmin(usuario: UserResponseDto) { - openDarAdmin = true; - usuarioDarAdmin = usuario; - } - // $inspect(usuarios); let timeoutId: ReturnType | number | undefined; function buscarUsuarios() { @@ -196,7 +176,11 @@ - { + open = true; + usuarioCambioPass = usuario; + }}> @@ -205,7 +189,12 @@ - +

Modificar Usuario

@@ -215,7 +204,10 @@ @@ -231,7 +223,10 @@