-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: zustand name, amount 변경 가능하도록 메서드 추가 * feat: CurrentRecruitmentType 타입 변경 * feat: 하드코딩이 아닌 API 값으로 이름 변경
- Loading branch information
Showing
3 changed files
with
47 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,41 @@ | ||
import { Flex, Text } from '@/components/common/Wrapper'; | ||
import Box from 'wowds-ui/Box'; | ||
import { useProductBase } from '@/hooks/zustand/useProduct'; | ||
import memberApi from '@/apis/member/memberApi'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
import LoadingSpinner from '../common/LoadingSpinner'; | ||
import { useEffect } from 'react'; | ||
|
||
export const PaymentItemBox = () => { | ||
const { name, strAmount } = useProductBase(); | ||
const { name, strAmount, setName, setAmount } = useProductBase(); | ||
const { data: member, isLoading } = useQuery({ | ||
queryKey: ['member'], | ||
queryFn: memberApi.GET_DASHBOARD | ||
}); | ||
|
||
useEffect(() => { | ||
if (member) { | ||
setName(member.currentRecruitmentRound.feeName); | ||
setAmount(member.currentRecruitmentRound.fee); | ||
} | ||
}, [member, setAmount, setName]); | ||
|
||
return ( | ||
<Flex justify="flex-start" direction="column" align="flex-start" gap="sm"> | ||
<Text typo="h2" color="black"> | ||
결제 항목 | ||
</Text> | ||
<Box text={name} subText={`금액 ${strAmount}원`} status="success" /> | ||
</Flex> | ||
<> | ||
{isLoading || !member ? ( | ||
<LoadingSpinner /> | ||
) : ( | ||
<Flex | ||
justify="flex-start" | ||
direction="column" | ||
align="flex-start" | ||
gap="sm"> | ||
<Text typo="h2" color="black"> | ||
결제 항목 | ||
</Text> | ||
<Box text={name} subText={`금액 ${strAmount}원`} status="success" /> | ||
</Flex> | ||
)} | ||
</> | ||
); | ||
}; |
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