mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-20 16:17:32 -03:00
movi la logica de traer los posts al componente
This commit is contained in:
@@ -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: [] };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user