chore: movi el getPosts a hooks/ y le agrege un header

This commit is contained in:
2025-12-03 15:04:31 -03:00
parent 6ac942fde0
commit 18670e62dd
2 changed files with 18 additions and 14 deletions

View File

@@ -10,6 +10,7 @@
import ModalEditar from './[perfil]/modalEditar.svelte';
import { updatePost } from '@/hooks/updatePost';
import { fade, slide } from 'svelte/transition';
import { getPosts } from '@/hooks/getPosts';
$effect(() => {
(async () => {
@@ -17,20 +18,6 @@
})();
});
async function getPosts() {
const { subscribe } = apiBase;
let baseUrl: string = '';
subscribe((value) => {
baseUrl = value;
})();
const req = await fetch(`${baseUrl}/timeline?pageSize=20`);
if (req.ok) {
return await req.json();
}
}
let postAModificar: Post | null = $state(null);
let mensajeError = $state('');