mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-01 13:10:44 -03:00
@@ -38,7 +38,7 @@
|
||||
});
|
||||
if (image === null) return;
|
||||
cargando = true;
|
||||
await updateUsuario({ id: data.id, profileImage: true, image: image });
|
||||
await updateUsuario({ id: data.id, profileImage: false, image: image });
|
||||
let ret = await obtenerUsuarioPorUsername(data.username);
|
||||
if (ret) {
|
||||
data = { ...data, ...ret };
|
||||
@@ -92,7 +92,8 @@
|
||||
</h1>
|
||||
{#if usu.bio}
|
||||
<p class="mt-4 rounded-4xl bg-accent p-4 text-center text-muted-foreground">
|
||||
{@html usu.bio.replaceAll('\n', '<br>')}
|
||||
{usu.bio.replaceAll('\n', '<br>')}
|
||||
<!-- {@html usu.bio.replaceAll('\n', '<br>')} -->
|
||||
</p>
|
||||
{/if}
|
||||
{:else}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import type { Post } from '../../types';
|
||||
|
||||
export const posts = writable<Post[]>([]);
|
||||
export const posts = writable<Post[] | undefined>(undefined);
|
||||
|
||||
export const setPosts = (newPosts: Post[]) => {
|
||||
posts.set(newPosts);
|
||||
@@ -20,9 +20,10 @@ export const updatePostStore = (postId: string, updatedData: Partial<Post>) => {
|
||||
export const removePost = (postId: string) => {
|
||||
posts.update((currentPosts) => {
|
||||
const a = currentPosts.filter((post) => post.id !== postId);
|
||||
console.log(a);
|
||||
return a;
|
||||
});
|
||||
|
||||
console.log(postId);
|
||||
};
|
||||
|
||||
export const resetPosts = () => {
|
||||
posts.set(undefined);
|
||||
};
|
||||
|
||||
@@ -3,15 +3,17 @@
|
||||
import { Content } from '@/components/ui/card';
|
||||
import { sesionStore } from '@/stores/usuario';
|
||||
import CrearPost from '@/components/crear-post.svelte';
|
||||
import { posts, setPosts, updatePostStore } from '@/stores/posts';
|
||||
import { posts, resetPosts, setPosts, updatePostStore } from '@/stores/posts';
|
||||
import PostCard from '@/components/PostCard.svelte';
|
||||
import type { Post } from '../types';
|
||||
import ModalEditar from './[perfil]/modalEditar.svelte';
|
||||
import { updatePost } from '@/hooks/updatePost';
|
||||
import { fade, slide } from 'svelte/transition';
|
||||
import { getPosts } from '@/hooks/getPosts';
|
||||
import Spinner from '@/components/ui/spinner/spinner.svelte';
|
||||
|
||||
$effect(() => {
|
||||
resetPosts();
|
||||
(async () => {
|
||||
setPosts(await getPosts());
|
||||
})();
|
||||
@@ -49,7 +51,14 @@
|
||||
{/if}
|
||||
<hr />
|
||||
|
||||
{#if $posts.length <= 0}
|
||||
{#if $posts === undefined}
|
||||
<Card>
|
||||
<Content class="flex items-center justify-center gap-2">
|
||||
<Spinner class="h-10 w-10" />
|
||||
<p>Cargando</p>
|
||||
</Content>
|
||||
</Card>
|
||||
{:else if $posts.length <= 0}
|
||||
<Card>
|
||||
<Content>
|
||||
<p class=" text-center leading-7 not-first:mt-6">No hay Posts que mostrar</p>
|
||||
|
||||
Reference in New Issue
Block a user