-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 내 초대코드 조회 query useGetMyInviteCode function으로 분리
- Loading branch information
1 parent
b9f9fb7
commit 15203f3
Showing
3 changed files
with
25 additions
and
9 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,3 +1,4 @@ | ||
export { default as useGetFriendships } from './useGetFriendships'; | ||
export { default as useDeleteFriendship } from './useDeleteFriendship'; | ||
export { default as useAddFriendship } from './useAddFriendship'; | ||
export { default as useGetMyInviteCode } from './useGetMyInviteCode'; |
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,17 @@ | ||
import { queryKeys } from '../queryKeys'; | ||
import { useBaseQuery } from '../useBaseQuery'; | ||
|
||
const useGetMyInviteCode = () => { | ||
const { data } = useBaseQuery<{ inviteCode: string }>( | ||
queryKeys.MY_INVITE_CODE(), | ||
'/users/me/invite-code', | ||
); | ||
|
||
if (!data?.data) { | ||
return { inviteCode: '-' }; | ||
} | ||
|
||
return data?.data; | ||
}; | ||
|
||
export default useGetMyInviteCode; |