Skip to content

Commit

Permalink
#161 data로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaeyeon1 committed Dec 14, 2023
1 parent 593c9d5 commit ef61874
Showing 1 changed file with 16 additions and 26 deletions.
42 changes: 16 additions & 26 deletions client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,29 @@
import PostData from '@/components/Post/PostData';
// import { SERVER_URL } from '@/constant/common';
import { SERVER_URL } from '@/constant/common';
import { Metadata } from 'next';
import React from 'react';

// const getData = async (id: number) => {
// const res = await fetch(`${SERVER_URL}/post?postId=${id}`);
// return res.json();
// };
const getData = async (id: number) => {
const res = await fetch(`${SERVER_URL}/post?postId=${id}`);
return res.json();
};

export const generateMetadata = async ({
params,
}: {
params: { id: string };
}): Promise<Metadata> => {
const data = await getData(Number(params.id));

export const generateMetadata = async (): Promise<Metadata> => {
return {
title: '타이틀입니다.',
description: 'ㅁㄴㅇㄹ',
title: data.title,
description: data.content,
openGraph: {
title: 'openGraph 타이틀이빈다.',
description: 'ㅁㄴㅇㄹ',
title: data.title,
description: data.content,
},
};
};
// export const generateMetadata = async ({
// params,
// }: {
// params: { id: string };
// }): Promise<Metadata> => {
// const data = await getData(Number(params.id));

// return {
// title: '타이틀입니다.',
// description: 'ㅁㄴㅇㄹ',
// openGraph: {
// title: 'openGraph 타이틀이빈다.',
// description: 'ㅁㄴㅇㄹ',
// },
// };
// };

function page({ params }: { params: { blogName: string; categoryId: string; postId: string } }) {
return (
Expand Down

0 comments on commit ef61874

Please sign in to comment.