Skip to content

Commit

Permalink
feat: nickname 삭제 api
Browse files Browse the repository at this point in the history
  • Loading branch information
ukkodeveloper committed Oct 19, 2023
1 parent b51f83f commit ba945b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion frontend/src/features/member/hooks/useWithdrawal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import { useMutation } from '@/shared/hooks/useMutation';
const useWithdrawal = () => {
const navigate = useNavigate();
const { user, logout } = useAuthContext();
const { mutateData: withdrawMember } = useMutation(deleteMember(user?.memberId));
// TODO: 피드백 반영하여 error throw. 그러나 error 핸들링 반드시 필요
if (!user) {
throw new Error('현재 user 로그인된 정보가 없습니다.');
}

const { mutateData: withdrawMember } = useMutation(() => deleteMember(user.memberId));

const handleWithdrawal = async () => {
await withdrawMember();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/features/member/remotes/member.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fetcher from '@/shared/remotes';

export const deleteMember = (memberId: number | undefined) => () => {
export const deleteMember = (memberId: number) => {
return fetcher(`/members/${memberId}`, 'DELETE');
};

0 comments on commit ba945b9

Please sign in to comment.