-
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.
Merge pull request #214 from KKYHH/feat/RewardPage
✨ feat: 리워드 내역 페이지 UI 구현
- Loading branch information
Showing
18 changed files
with
443 additions
and
182 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { END_POINT } from '@constants/api'; | ||
import { CONSOLE_ERROR } from '@constants/message'; | ||
import API from '@services/index'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { useUser } from '@state/user/useUser'; | ||
import { AxiosError } from 'axios'; | ||
|
||
export const useRewardHistory = () => { | ||
const memberId = useUser(); | ||
|
||
const fetchUseRewardHistory = async (): Promise<RewardHistory[]> => { | ||
const res = await API.get(END_POINT.reward_history(memberId)); | ||
return res.data; | ||
}; | ||
|
||
const { | ||
data: history, | ||
isError, | ||
error, | ||
} = useQuery< | ||
RewardHistory[], | ||
AxiosError, | ||
RewardHistory[], | ||
[string, number | undefined] | ||
>({ | ||
queryKey: ['rewardHistory', memberId], | ||
queryFn: fetchUseRewardHistory, | ||
enabled: !!memberId, | ||
}); | ||
|
||
if (isError) console.error(CONSOLE_ERROR.reward.get + error.message); | ||
|
||
return { history }; | ||
}; |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.