feat(blog::api) fix apis, frontend

This commit is contained in:
lumither committed 2024-12-01 02:35:13 -08:00
1 parent cbc831bb70
commit a0dc40d2ca
14 files changed
+82 -226

No files matched your search

+4 -4
View File
@@ -18,11 +18,11 @@ const Headers = (props: Props) => {
// let last_update = new Date((post as any)['last_update']);
let first_update = new Date(post['first_update']);
// let post_id = (post as any)['post_id'];
let header_img = post['header_img'];
let header_img = post['meta']['header_img'] as string | null;
return (
<>
{ header_img !== '' && <div className={ `w-full overflow h-96 relative` }>
{ header_img && <div className={ `w-full overflow h-96 relative` }>
<Image
alt={ 'cover picture' }
src={ header_img }
@@ -38,11 +38,11 @@ const Headers = (props: Props) => {
</div> }
<div
className={ header_img !== '' ?
className={ header_img ?
'mx-8 -mt-16 backdrop-blur transition bg-zinc-300/80 dark:bg-gray-600/25 rounded-2xl z-30'
: 'mx-6 mt-6'
}>
<div className={ header_img !== '' ? `p-4` : 'p-4 pt-2' }>
<div className={ header_img ? `p-4` : 'p-4 pt-2' }>
<Chip className={ `mb-2` } radius={ `sm` } color={ `secondary` }
variant={ `solid` }>{ category }</Chip>
<p className={ `text-4xl font-bold` }> { title }</p>
+1 -1
View File
@@ -13,7 +13,7 @@ async function PostCard(props: Props) {
try {
const res = await fetchNocturneApi(`/get_post/${ props.id }`);
const res = await fetchNocturneApi(`/blog/get_post/${ props.id }`);
const ret: any = await res.json();
return (
<div>
+6 -2
View File
@@ -3,7 +3,11 @@ import PostCard from '@/app/blog/post/[id]/PostCard';
import { MotionDiv } from '@/app/public/MotionDiv';
import ButtonGoBack from '@/app/blog/post/[id]/ButtonGoBack';
function BlogReader({ params }: { params: { id: string } }) {
async function BlogReader({
params
}: {
params: Promise<{ id: string }>
}) {
return (
<MotionDiv
@@ -13,7 +17,7 @@ function BlogReader({ params }: { params: { id: string } }) {
transition={ { ease: 'easeInOut', duration: 0.5 } }
>
<div className={ `max-w-full` }>
<PostCard id={ params.id } />
<PostCard id={ (await params).id } />
</div>
<div className={ 'mt-3' }>
<ButtonGoBack />