Skip to content

Commit

Permalink
feat : update mypage/index.js (#74)
Browse files Browse the repository at this point in the history
총 할인 금액 API 추가
  • Loading branch information
JungYeonHwi committed Oct 9, 2023
1 parent 6c55384 commit 97849b9
Showing 1 changed file with 17 additions and 28 deletions.
45 changes: 17 additions & 28 deletions pages/mypage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,29 @@ import { useEffect, useState, useRef } from 'react'
import Title from '@molecules/title';
import MypageContentInfoTemplate from '@components/templates/mypageContentInfoTemplate';
import useGetNickName from '@hooks/useGetNickName';
import useGetDiscountTotal from '@hooks/useGetDiscountTotal';

const mypage = () => {

let data = [
{
id: 1,
value: {
name: '좋은 원두1',
discountMoney : 15000
},
},
{
id: 2,
value: {
name: '좋은 원두2',
discountMoney : 2000
},
},
{
id: 3,
value: {
name: '좋은 원두3',
discountMoney : 3000
},
},
]
const Mypage = () => {

const [userInfo, setUserInfo] = useState("");
const [discountInfo, setDiscountInfo] = useState("");

const getNickName = useGetNickName();
const getDiscountTotal = useGetDiscountTotal();

useEffect(() => {
setUserInfo(getNickName);
setDiscountInfo(getDiscountTotal);
},[getNickName, getDiscountTotal]);

console.log(discountInfo)

return (
<>
<Title text="마이페이지" />
<MypageContentInfoTemplate name="권낙현" totalMoney="15000" discountData={data}/>
<MypageContentInfoTemplate name={data.nickname} totalMoney="15000" />
<MypageContentInfoTemplate name={userInfo.nickname} discountData={discountInfo}/>
</>
)
}

export default mypage
export default Mypage

0 comments on commit 97849b9

Please sign in to comment.