diff --git a/src/lib/components/BotonSeguir.svelte b/src/lib/components/BotonSeguir.svelte index 81739a9..e64aab3 100644 --- a/src/lib/components/BotonSeguir.svelte +++ b/src/lib/components/BotonSeguir.svelte @@ -16,9 +16,9 @@ let { post, variant = 'icon-lg' - }: { post: Omit, 'authorId'> & { authorId: string }; variant?: string } = $props(); + }: { post: Omit, 'authorId'> & { authorId: string; id: string }; variant?: 'icon-lg' | 'default' | 'sm' | 'lg' | 'icon' | 'icon-sm' } = $props(); - let seguido: Boolean | null = $state(null); + let seguido: boolean | null = $state(null); if (typeof window !== 'undefined') { window.addEventListener('followCacheUpdated', (( @@ -40,9 +40,11 @@ async function cargarSeguido() { let a = cacheSeguidos.get(post.authorId); if (a === undefined) { - const seguidoStatus = await esSeguido(post); - cacheSeguidos.set(post.authorId, seguidoStatus.isFollowing || false); - seguido = seguidoStatus.isFollowing || false; + const seguidoStatus = await esSeguido(post as Post); + if (seguidoStatus) { + cacheSeguidos.set(post.authorId, seguidoStatus.isFollowing || false); + seguido = seguidoStatus.isFollowing || false; + } return; } seguido = a; diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 4e43c01..4c11787 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -92,7 +92,7 @@ {:else} {#each $posts as post (post.id)} -
+
{/each} diff --git a/src/routes/[perfil]/+page.svelte b/src/routes/[perfil]/+page.svelte index 24861f1..472b895 100644 --- a/src/routes/[perfil]/+page.svelte +++ b/src/routes/[perfil]/+page.svelte @@ -1,6 +1,5 @@ -
{#key data} {/key} -

+ +

Posts: - {#if params.perfil == $sesionStore?.username} + {#if params.perfil === $sesionStore?.username} - {:else if $posts?.length == 0} - + {:else if $posts.length === 0} + {/if}


- {#if cargando} + + {#if cargando && $posts.length === 0} - {:else if mensajeError !== ''} + {:else if mensajeError} + {:else if $posts.length === 0} + {:else}
{#each $posts as post (post.id)} @@ -110,40 +152,37 @@ {/each}
{/if} + +
+ + {#if cargando && $posts.length > 0} +
+ +
+ {/if}
+ {#if postAModificar}
{/if} -
- (showCrearPost = false)}> - { - if (e.ctrlKey && e.key === 'Enter') { - showCrearPost = false; - } - }} - > - Crear Publicacion - - - -
+ (showCrearPost = false)}> + + Crear publicación + + + -{#if $sesionStore?.isAdmin || $sesionStore?.username == params.perfil} +{#if $sesionStore?.isAdmin || $sesionStore?.username === params.perfil}
- + - +
{/if} @@ -152,6 +191,5 @@ - - + \ No newline at end of file