+
{ children }
);
diff --git a/app/blog/page.tsx b/app/blog/page.tsx
index df6cdb4..4428fc5 100644
--- a/app/blog/page.tsx
+++ b/app/blog/page.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import fetch_posts_list from '@/app/blog/fetch_posts_list';
import BlogPostCard from '@/app/blog/BlogPostCard';
+import { Card, CardBody } from '@nextui-org/card';
async function Blog() {
@@ -9,9 +10,9 @@ async function Blog() {
let posts = res['posts'];
return (
// blog list
-
+
{ posts.map((post: JSON, key: React.Key | null | undefined) => (
- -
+
-
)
) }
@@ -19,10 +20,11 @@ async function Blog() {
);
} catch (e: any) {
return (
- <>
- { e.toString() }
- >
- );
+
+
+ Fatal: Failed to load post list.
+
+ );
}
}
diff --git a/app/blog/post/[id]/generate.tsx b/app/blog/post/[id]/generate.tsx
index 10049a5..a39a7c8 100644
--- a/app/blog/post/[id]/generate.tsx
+++ b/app/blog/post/[id]/generate.tsx
@@ -16,8 +16,11 @@ type Props = {
}
async function Generate(props: Props) {
- const response = await axios(`http://localhost:${ process.env.BACKEND_PORT }/api/get/post/${ props.id }`);
- if (response.status !== 200) {
+
+ let response: any;
+ try {
+ response = await axios(`http://localhost:${ process.env.BACKEND_PORT }/api/get/post/${ props.id }`);
+ } catch (e) {
return (
@@ -27,6 +30,7 @@ async function Generate(props: Props) {
);
}
+
let post_data = response.data;
return (
@@ -34,12 +38,11 @@ async function Generate(props: Props) {
{ (post_data as any)['content'] }
-
);
diff --git a/components/ThemeSwitcher.tsx b/components/ThemeSwitcher.tsx
index 75b2666..7e0fa55 100644
--- a/components/ThemeSwitcher.tsx
+++ b/components/ThemeSwitcher.tsx
@@ -33,7 +33,7 @@ function ThemeSwitcher() {
}
} }
>
-