Skip to content

Commit

Permalink
Merge pull request #136 from kdt-8-4/develop
Browse files Browse the repository at this point in the history
[fix] #14 게시글 작성 유저 정보 백엔드 연결
  • Loading branch information
nebulaBdj authored May 18, 2024
2 parents 59a050d + 0735081 commit c47be9a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Image from 'next/image'
export default function DetailProfile({ userData }: { userData: UserData }) {
return (
<div className="flex items-center font-NanumSquareRound mt-5">
<Image
{/* <Image
src={
'https://cdnimg.melon.co.kr/cm2/artistcrop/images/002/61/143/261143_20210325180240_500.jpg?61e575e8653e5920470a38d1482d7312/melon/optimize/90'
}
Expand All @@ -18,9 +18,9 @@ export default function DetailProfile({ userData }: { userData: UserData }) {
<div className="flex-col ml-3 pb-1">
<p className="text-lg">홍길동</p>
<p className="text-xs text-gray-400">@user1</p>
</div>
</div> */}
{/* 백엔드 해결되면 위에 코드 지우고 아래 살리면 됨 */}
{/* {userData.image == null ? (
{userData.image == null ? (
<IconStore
iconStyle={IconStyle.MY_PROFILE_FILL}
size={50}
Expand All @@ -37,8 +37,10 @@ export default function DetailProfile({ userData }: { userData: UserData }) {
)}
<div className="flex-col ml-3 pb-1">
<p className="text-lg">{userData.nickname}</p>
<p className="text-xs text-gray-400">@{userData.email.split('@')[0]}</p>
</div> */}
<p className="text-xs text-gray-400">
@{userData?.email?.split('@')[0]}
</p>
</div>
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default function DetailOrganism({ boardId }: { boardId: BOARDID }) {
useEffect(() => {
const fetchData = async () => {
try {
// 게시글 정보
const fetchBoardDataResponse = await fetch(
`https://www.jerneithe.site/board/detail/${boardId}`,
{
Expand All @@ -30,16 +31,12 @@ export default function DetailOrganism({ boardId }: { boardId: BOARDID }) {
console.log('fetchBoardData: ', fetchBoardData)

// 작성 유저 정보
// 작성한 유저의 정보를 가져오는 거라서 token 값이 들어가면 안됨
// 일단 오류 방지를 위해 현재 로그인한 유저의 토큰값을 보내서 정보를 가져올 수 있음
// 로그인 안해도 게시물 확인할 수 있도록 토큰값 없이 작성자 정보 불러오기
const fetchUserDataResponse = await fetch(
`https://www.jerneithe.site/user/api/userinfo`,
`https://www.jerneithe.site/user/simpleuserinfo`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + accesstoken,
},
body: JSON.stringify({
nickname: fetchBoardData.nickName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function LikeAndComment({
}

return (
<div className="flex">
<div className="flex cursor-pointer">
<div onClick={toggleLike} style={{ cursor: 'pointer' }}>
<IconStore
iconStyle={isUserLiked ? IconStyle.LIKE : IconStyle.UNLIKE}
Expand Down

0 comments on commit c47be9a

Please sign in to comment.