added drafts

This commit is contained in:
2026-05-14 20:04:04 +02:00
parent 7d04b764d5
commit 076375ad00
3 changed files with 15 additions and 4 deletions
+4 -1
View File
@@ -33,9 +33,12 @@ let siteConfig = {
welcome_subtitle: "An ongoing arrangement of pieces, sketches, and stray observations."
};
const cookieHeader = Astro.request.headers.get('cookie') ?? '';
const fetchHeaders: HeadersInit = cookieHeader ? { cookie: cookieHeader } : {};
try {
const [postsRes, configRes] = await Promise.all([
fetch(`${API_URL}/api/posts`),
fetch(`${API_URL}/api/posts`, { headers: fetchHeaders }),
fetch(`${API_URL}/api/config`)
]);
+4 -1
View File
@@ -42,8 +42,11 @@ let post: PostDetail | null = null;
let html = '';
let error = '';
const cookieHeader = Astro.request.headers.get('cookie') ?? '';
const fetchHeaders: HeadersInit = cookieHeader ? { cookie: cookieHeader } : {};
try {
const postRes = await fetch(`${API_URL}/api/posts/${encodeURIComponent(slug ?? '')}`);
const postRes = await fetch(`${API_URL}/api/posts/${encodeURIComponent(slug ?? '')}`, { headers: fetchHeaders });
if (postRes.ok) {
post = await postRes.json();
html = renderMarkdown(post!.content, post!.dimensions);