-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from fastcampus-711/develop
Develop
- Loading branch information
Showing
16 changed files
with
359 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { NextRequest } from "next/server" | ||
|
||
export const GET = async ( | ||
request: NextRequest, | ||
context: { params: { category: string; id: string } } | ||
) => { | ||
const { category, id } = context.params | ||
|
||
try { | ||
const response = await fetch( | ||
`http://localhost:3001/${category}/${id}`, | ||
// `https://711.ha-ving.store/boards/${category}/${id}`, | ||
{ | ||
cache: "no-store" | ||
} | ||
) | ||
if (response.ok) { | ||
const responseData = await response.json() | ||
return Response.json(responseData) | ||
} else { | ||
console.error("게시물 불러오기를 실패했습니다.") | ||
} | ||
} catch (error) { | ||
console.error("에러 발생:", error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import type { NextRequest } from "next/server" | ||
|
||
export const GET = async ( | ||
request: NextRequest, | ||
context: { params: { category: string } } | ||
) => { | ||
const { category } = context.params | ||
const { searchParams } = request.nextUrl | ||
let url = `http://localhost:3001/${category}` | ||
// let url = `https://711.ha-ving.store/boards/${category}` | ||
|
||
// searchParams가 비어있지 않고, title이 존재하면서 값이 "undefined"가 아닌 경우에만 title을 URL에 추가합니다. | ||
if ( | ||
searchParams && | ||
searchParams.get("keyowrd") !== undefined && | ||
searchParams.get("keyword") !== "undefined" | ||
) { | ||
url += `?keyword=${searchParams.get("keyword")}` | ||
} | ||
|
||
try { | ||
const response = await fetch(url, { | ||
cache: "no-store" | ||
}) | ||
if (response.ok) { | ||
console.log(url) | ||
const responseData = await response.json() | ||
return Response.json(responseData) | ||
} else { | ||
console.error("게시물 불러오기를 실패했습니다.") | ||
} | ||
} catch (error) { | ||
console.error("에러 발생:", error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import FreeBoardDetail from "@/components/FreeBoardDetail" | ||
import QnaDetail from "@/components/QnaDetail" | ||
import ShareMarketDetail from "@/components/ShareMarketDetail" | ||
|
||
export default async function Page({ | ||
params | ||
}: { | ||
params: { category: string; id: string } | ||
}) { | ||
const { category, id } = params | ||
|
||
const res = await fetch( | ||
`${process.env.NEXT_PUBLIC_CLIENT_URL}/api/complaints/${category}/${id}` | ||
) | ||
const responseData = await res.json() | ||
let componentProps = { responseData } | ||
let contentComponent | ||
|
||
if (category === "allcomplaints") { | ||
contentComponent = <QnaDetail {...componentProps} /> | ||
} else if (category === "mycomplaints") { | ||
contentComponent = <ShareMarketDetail {...componentProps} /> | ||
} else { | ||
contentComponent = null | ||
} | ||
|
||
return <div className="max-w-[1200px] m-auto">{contentComponent}</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import CommunitySearch from "@/components/CommunitySearch" | ||
import BoardSubMenuBar from "@/components/submenu/SubMenuBar" | ||
import SetCategory from "@/components/SetCategory" | ||
import AllComplaints from "@/components/AllComplaints" | ||
import MyComplaints from "@/components/MyComplaints" | ||
|
||
export default async function Page({ | ||
params, | ||
searchParams | ||
}: { | ||
params: { category: string } | ||
searchParams: { title: string } | ||
}) { | ||
const { category } = params | ||
const { title } = searchParams | ||
|
||
const res = await fetch( | ||
`${process.env.NEXT_PUBLIC_CLIENT_URL}/api/complaints/${category}?keyword=${title}` | ||
) | ||
const responseData = await res.json() | ||
let componentProps = { responseData, category } | ||
let contentComponent | ||
|
||
if (category === "allcomplaints") { | ||
contentComponent = <AllComplaints {...componentProps} /> | ||
} else if (category === "mycomplaints") { | ||
contentComponent = <MyComplaints {...componentProps} /> | ||
} else { | ||
contentComponent = null | ||
} | ||
return ( | ||
<div className="max-w-[1200px] m-auto mb-40"> | ||
<SetCategory category={category} /> | ||
<div className="py-8"> | ||
<p className="text-grey_900 text-[32px] font-semibold">민원게시판</p> | ||
</div> | ||
{/* <Link href={"/community/freeboard"}>자유게시판</Link> | ||
<Link href={"/community/sharemarket"}>나눔장터</Link> | ||
<Link href={"/community/qna"}>QnA</Link> | ||
<CommunitySearch category={category} /> */} | ||
<div className="flex justify-between"> | ||
<BoardSubMenuBar | ||
option="community" | ||
category={category} | ||
/> | ||
<CommunitySearch | ||
category={category} | ||
placeholder="게시판 내 재검색" | ||
className="flex-1 max-w-[480px]" | ||
/> | ||
</div> | ||
{contentComponent} | ||
</div> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.