mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-20 16:17:32 -03:00
añadido pagina de Posts, una store para la api, y header para mobile
This commit is contained in:
16
src/routes/+page.ts
Normal file
16
src/routes/+page.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
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