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