-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: api fetching에 따른 폴더 네이밍 수정 (#35)
- Loading branch information
Showing
19 changed files
with
88 additions
and
62 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,76 @@ | ||
"use client"; | ||
|
||
/* eslint-disable no-restricted-imports */ | ||
|
||
import { useSession } from "next-auth/react"; | ||
import React, { useEffect, useState } from "react"; | ||
// user mock data | ||
// import { userMock } from "@/app/(userpage)/userMock"; | ||
import Activity from "@/components/Card/Activity/Activity"; | ||
import cn from "@/utils/classNames"; | ||
// 추후 데이터 연결시 받아온데이터로 변환 예정 | ||
import HttpClient from "@/utils/httpClient"; | ||
import UserActivityList from "./components/UserActivityList/UserActivityList"; | ||
import UserInfo from "./components/UserInfo/UserInfo"; | ||
import styles from "./UserPage.module.scss"; | ||
import { UserDetail } from "../../types"; | ||
|
||
export default function UserPage({ params }: { params: { userId: number } }) { | ||
const { data: session } = useSession(); | ||
const [userData, setUserData] = useState<UserDetail>(); | ||
|
||
const httpClient = new HttpClient(process.env.NEXT_PUBLIC_BASE_URL!); | ||
|
||
const getUserData = async () => { | ||
if (session) { | ||
const ACCESS_TOKEN = session.accessToken; | ||
setUserData( | ||
await httpClient.get(`users/${params.userId}`, { | ||
headers: { Authorization: ACCESS_TOKEN }, | ||
cache: "no-cache", | ||
}), | ||
); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
getUserData(); | ||
}, []); | ||
|
||
return ( | ||
<div className={cn(styles.container)}> | ||
{userData && ( | ||
<> | ||
<UserInfo | ||
nickname={userData.nickname} | ||
image={userData.image} | ||
description={userData.description} | ||
follower={userData.followersCount} | ||
folloing={userData.followeesCount} | ||
isfollow={userData.isFollowing} | ||
/> | ||
<div className={styles.activity}> | ||
<section> | ||
<p className={styles.activityDetailText}>활동 내역</p> | ||
<div className={styles.activityDetails}> | ||
<Activity | ||
title='남긴 별점 평균' | ||
averageRating={userData.averageRating} | ||
/> | ||
<Activity | ||
title='남긴 리뷰' | ||
reviewCount={userData.reviewCount} | ||
/> | ||
<Activity | ||
title='관심 카테고리' | ||
chipCategoty={userData.mostFavoriteCategory} | ||
/> | ||
</div> | ||
</section> | ||
<UserActivityList /> | ||
</div> | ||
</> | ||
)} | ||
</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