Skip to content

Commit

Permalink
Merge pull request #227 from Meetfolio-Project-CodeZ-Team/develop
Browse files Browse the repository at this point in the history
merge to main
  • Loading branch information
NAKDO authored Jun 2, 2024
2 parents 5186fad + 910a0ec commit 8d34338
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
8 changes: 3 additions & 5 deletions src/app/api/board/detail/route.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { postBoardDetail } from '@/app/service/postRequests'
import { getBoardDetail } from '@/app/service/getRequests'
import { getCookie } from '@/app/utils/cookies'
import { NextResponse } from 'next/server'

export async function POST(request: Request) {
export async function GET(request: Request):Promise<NextResponse> {
let accessToken = getCookie(request, 'accessToken')
const { searchParams } = new URL(request.url)
const id = searchParams.get('id') || ''
const data = await postBoardDetail(accessToken, id)

console.log(data, accessToken, id, '디테일 요청')
const data = await getBoardDetail(accessToken, id)

return NextResponse.json(data)
}
8 changes: 1 addition & 7 deletions src/app/components/mypage/BoardCardDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,7 @@ const BoardCardDetail = ({ nickname, profile }: BoardDetailContainer) => {
if (isSelected) {
const fetchData = async () => {
const response = await fetch(
`${process.env.NEXT_PUBLIC_NEXT_SERVER}/api/board/detail?id=${selectedId}`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
},
`${process.env.NEXT_PUBLIC_NEXT_SERVER}/api/board/detail?id=${selectedId}`
)
const resData = await response.json()
setData(resData.result.boardInfo)
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/mypage/MyCommentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const MyCommentCard = ({
{content}
</div>
</div>
<div className="w-[300px] h-[18px] left-[34px] top-[20px] absolute text-zinc-600 text-lg font-bold leading-[30px]">
<div className=" h-[18px] left-[34px] top-[20px] absolute text-zinc-600 text-lg font-bold leading-[30px]">
{boardTitle}
</div>
<div className="left-[970px] top-[67px] absolute text-slate-600 text-sm font-normal leading-[30px]">
Expand Down
5 changes: 5 additions & 0 deletions src/app/service/getRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,8 @@ export const getComments = async (accessToken: string, id: string) => {
const url = `${SERVER_URL}/api/board-comments/${id}?page=0`
return await getRequest(url, accessToken)
}

export const getBoardDetail = async (accessToken: string, id: string) => {
const url = `${SERVER_URL}/api/boards/${id}`
return await getRequest(url, accessToken)
}

0 comments on commit 8d34338

Please sign in to comment.