Skip to content

Commit

Permalink
fix: cannot destructure about
Browse files Browse the repository at this point in the history
  • Loading branch information
moonbamijam committed Feb 12, 2024
1 parent 67a2d57 commit dbd31e5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/api/about/[id]/route.ts → app/api/abouts/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ export async function PUT(request: Request, { params }: Params) {
export async function GET(request: Request, { params }: Params ) {
const { id } = params;
await connectMongoDB();
const about = await About.findOne({ _id: id });
return NextResponse.json({ about }, { status: 200 });
const abouts = await About.findOne({ _id: id });
return NextResponse.json({ abouts }, { status: 200 });
};
4 changes: 2 additions & 2 deletions app/api/about/route.ts → app/api/abouts/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ export async function POST(request: Request, response: Response) {

export async function GET() {
await connectMongoDB();
const about = await About.find();
return NextResponse.json({ about })
const abouts = await About.find();
return NextResponse.json({ abouts })
};
6 changes: 3 additions & 3 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function HandleTopics() {

async function HandleAboutMe() {
try {
const response = await fetch(process.env.URL + `/api/about`, {
const response = await fetch(process.env.URL + `/api/abouts`, {
cache: 'no-store',
method: 'GET'
});
Expand All @@ -52,7 +52,7 @@ async function HandleAboutMe() {

const Home = async () => {
const { topics } = await HandleTopics()
const { about } = await HandleAboutMe()
const { abouts } = await HandleAboutMe()
return (
<>
<Image priority src={ AkaneDream } alt="" id="home-bg" width={'3000'} height={'3000'} className="w-full h-[930px] object-cover absolute z-[-100] opacity-[0.5] dark:opacity-[0.3] " />
Expand All @@ -74,7 +74,7 @@ const Home = async () => {
<div className="about-me w-full flex flex-col lg:flex-row justify-between items-center lg:items-start 2xl:justify-evenly ">
<TopicImage src={ Me } />
<div className="about-me flex flex-col gap-[30px] ">
{about.map((about: AboutType) => (
{abouts.map((about: AboutType) => (
<About
key={ about._id }
displayName={ about.displayName }
Expand Down

0 comments on commit dbd31e5

Please sign in to comment.