movi la logica de traer los posts al componente

This commit is contained in:
2025-11-14 16:35:14 -03:00
parent 50187910b4
commit 543f253db5
2 changed files with 21 additions and 19 deletions

View File

@@ -1,16 +1 @@
import { apiBase } from '@/stores/url';
export const ssr = true;
export async function load({}) {
const { subscribe } = apiBase;
let baseUrl: string = '';
subscribe((value) => {
baseUrl = value;
})();
const req = await fetch(`${baseUrl}/Posts`);
if (req.ok) return { posts: req };
else return { posts: [] };
}