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,17 +0,0 @@
NPM_TOKEN=
# Name: Toby Purdy
MAIL_TRANSPORT_HOST=smtp.ethereal.email
MAIL_TRANSPORT_PORT=587
MAIL_TRANSPORT_USER=toby.purdy58@ethereal.email
MAIL_TRANSPORT_PASS=2bh8GWQpB2FWk6Eu9S
STRAPI_HOST=
STRAPI_PORT=
DATABASE_CLIENT=
DATABASE_HOST=
DATABASE_PORT=
DATABASE_NAME=
DATABASE_USERNAME=
DATABASE_PASSWORD=

View file

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

View file

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

View file

@ -30,9 +30,7 @@
"type": "media", "type": "media",
"multiple": false, "multiple": false,
"required": true, "required": true,
"allowedTypes": [ "allowedTypes": ["images"]
"images"
]
} }
} }
} }