format
Some checks failed
PR Gate / Checks (pull_request) Failing after 33s

This commit is contained in:
Benjamin Palko 2025-05-05 12:33:09 -04:00
parent 19b541d51a
commit acfdc38dd4
4 changed files with 49 additions and 69 deletions

View file

@ -1,5 +1,5 @@
import { env } from "$env/dynamic/private";
import type { PageServerLoad } from "./$types";
import { env } from '$env/dynamic/private';
import type { PageServerLoad } from './$types';
type Dates = {
createdAt: string;
@ -71,20 +71,19 @@ export const load: PageServerLoad = async () => {
const response = await fetch(
`http://${env.STRAPI_HOST}:${env.STRAPI_PORT}/api/blogs?populate=Header&populate=Topics`,
{
method: "GET",
method: 'GET',
headers: {
Authorization: `bearer ${env.STRAPI_TOKEN}`,
},
},
Authorization: `bearer ${env.STRAPI_TOKEN}`
}
}
);
const { data, meta }: { data: BlogPost[]; meta: Meta } =
await response.json();
const { data, meta }: { data: BlogPost[]; meta: Meta } = await response.json();
console.log(JSON.stringify(data, null, 2));
return {
posts: data,
meta,
meta
};
};

View file

@ -1,16 +1,16 @@
import { env } from "$env/dynamic/private";
import type { PageServerLoad } from "./$types";
import { env } from '$env/dynamic/private';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ params }) => {
const { slug } = params;
const response = await fetch(
`http://${env.STRAPI_HOST}:${env.STRAPI_PORT}/api/blogs/${slug}?populate=Header&populate=Topics`,
{
method: "GET",
method: 'GET',
headers: {
Authorization: `bearer ${env.STRAPI_TOKEN}`,
},
},
Authorization: `bearer ${env.STRAPI_TOKEN}`
}
}
);
const { data, meta } = await response.json();
@ -19,6 +19,6 @@ export const load: PageServerLoad = async ({ params }) => {
return {
post: data,
meta,
meta
};
};