chore: checkpoint admin editor and perf work
This commit is contained in:
@@ -29,16 +29,21 @@ const { slug } = Astro.params;
|
||||
let post = null;
|
||||
let siteSettings = DEFAULT_SITE_SETTINGS;
|
||||
|
||||
try {
|
||||
post = await apiClient.getPostBySlug(slug ?? '');
|
||||
} catch (error) {
|
||||
console.error('API Error:', error);
|
||||
const [postResult, siteSettingsResult] = await Promise.allSettled([
|
||||
apiClient.getPostBySlug(slug ?? ''),
|
||||
apiClient.getSiteSettings(),
|
||||
]);
|
||||
|
||||
if (postResult.status === 'fulfilled') {
|
||||
post = postResult.value;
|
||||
} else {
|
||||
console.error('API Error:', postResult.reason);
|
||||
}
|
||||
|
||||
try {
|
||||
siteSettings = await apiClient.getSiteSettings();
|
||||
} catch (error) {
|
||||
console.error('Site settings API Error:', error);
|
||||
if (siteSettingsResult.status === 'fulfilled') {
|
||||
siteSettings = siteSettingsResult.value;
|
||||
} else {
|
||||
console.error('Site settings API Error:', siteSettingsResult.reason);
|
||||
}
|
||||
|
||||
if (!post) {
|
||||
@@ -59,7 +64,7 @@ const markdownProcessor = await createMarkdownProcessor();
|
||||
const renderedContent = await markdownProcessor.render(articleMarkdown);
|
||||
---
|
||||
|
||||
<BaseLayout title={post.title} description={post.description}>
|
||||
<BaseLayout title={post.title} description={post.description} siteSettings={siteSettings}>
|
||||
<ReadingProgress />
|
||||
<BackToTop />
|
||||
<Lightbox />
|
||||
|
||||
Reference in New Issue
Block a user