diff --git a/src/components/templates/AddFriendTemplate.tsx b/src/components/templates/AddFriendTemplate.tsx index 4d34801..d4466fc 100644 --- a/src/components/templates/AddFriendTemplate.tsx +++ b/src/components/templates/AddFriendTemplate.tsx @@ -1,11 +1,12 @@ import { LabelRoundBox, WarningLine } from '@/components/molecules'; import React, { useState } from 'react'; +import { + useAddFriendship, + useGetMyInviteCode, +} from '@/hooks/queries/friendship'; import { BulletNoticeBox } from '@/components/organisms'; import { MiniButton } from '@/components/atoms'; -import { queryKeys } from '@/hooks/queries/queryKeys'; -import { useAddFriendship } from '@/hooks/queries/friendship'; -import { useBaseQuery } from '@/hooks/queries/useBaseQuery'; import useToast from '@/hooks/useToast'; const FRIEND_ADD_SUCCESS_MESSAGE = '친구 추가가 완료되었습니다.'; @@ -23,7 +24,7 @@ const AddFriendTemplate: React.FC = () => { const onCopy: () => void = () => { navigator.clipboard - .writeText(myInviteCode?.data?.inviteCode ?? '') + .writeText(myInviteCode ?? '') .then(() => { showToast(CODE_COPY_SUCCESS_MESSAGE, 'success'); }) @@ -38,10 +39,7 @@ const AddFriendTemplate: React.FC = () => { } }; - const { data: myInviteCode } = useBaseQuery<{ inviteCode: string }>( - queryKeys.MY_INVITE_CODE(), - '/users/me/invite-code', - ); + const { inviteCode: myInviteCode } = useGetMyInviteCode(); return (