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 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
};
};

View file

@ -1,38 +1,36 @@
{
"kind": "collectionType",
"collectionName": "blogs",
"info": {
"singularName": "blog",
"pluralName": "blogs",
"displayName": "Blog",
"description": ""
},
"options": {
"draftAndPublish": true
},
"attributes": {
"Title": {
"type": "string",
"required": true,
"unique": true
},
"Body": {
"type": "richtext",
"required": true
},
"Topics": {
"displayName": "Tag",
"type": "component",
"repeatable": true,
"component": "shared.tag"
},
"Header": {
"type": "media",
"multiple": false,
"required": true,
"allowedTypes": [
"images"
]
}
}
"kind": "collectionType",
"collectionName": "blogs",
"info": {
"singularName": "blog",
"pluralName": "blogs",
"displayName": "Blog",
"description": ""
},
"options": {
"draftAndPublish": true
},
"attributes": {
"Title": {
"type": "string",
"required": true,
"unique": true
},
"Body": {
"type": "richtext",
"required": true
},
"Topics": {
"displayName": "Tag",
"type": "component",
"repeatable": true,
"component": "shared.tag"
},
"Header": {
"type": "media",
"multiple": false,
"required": true,
"allowedTypes": ["images"]
}
}
}