-
Notifications
You must be signed in to change notification settings - Fork 0
[#233] 회원 탈퇴 구현 구현 #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[#233] 회원 탈퇴 구현 구현 #234
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ab7edfc
Merge pull request #230 from DevKor-github/dev
jw0202058 2bdd980
Merge branch 'dev'
halionaz e2d92e9
Merge branch 'dev'
halionaz b49e9e5
Merge branch 'dev'
halionaz 2d2acd0
Merge branch 'dev'
halionaz 37be0fc
Merge branch 'dev'
halionaz 0a46c53
Merge pull request #231 from DevKor-github/dev
jw0202058 4168362
Merge pull request #232 from DevKor-github/dev
halionaz 7664529
Merge branch 'dev'
jw0202058 46ac8ce
Merge branch 'dev'
halionaz bc84ce2
Merge branch 'dev'
halionaz 5df17aa
feat: 회원 탈퇴
halionaz ec68802
fix: prod에서 로그인 url 리다이렉션 src 삭제
halionaz d8e92ae
fix(mod): thx copilot-모달창 닫히게
halionaz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,20 @@ | ||
| import client from '@/common/utils/client'; | ||
| import { QUERY_KEYS } from '@/libs/queryKeys'; | ||
| import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
|
|
||
| const deleteUser = async () => { | ||
| const response = await client.delete('/api/v1/user'); | ||
| return response.data; | ||
| }; | ||
|
|
||
| export const useDeleteUser = () => { | ||
| const queryClient = useQueryClient(); | ||
|
|
||
| return useMutation({ | ||
| mutationFn: deleteUser, | ||
| onSuccess: () => { | ||
| queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.USER] }); | ||
| queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.IS_LOGIN] }); | ||
| }, | ||
| }); | ||
| }; | ||
44 changes: 44 additions & 0 deletions
44
src/features/my/components/MyTrade/DeleteAccountButton.tsx
This file contains hidden or 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,44 @@ | ||
| import CustomAlert from '@/common/components/CustomAlert'; | ||
| import { useToast } from '@/common/hooks/useToast'; | ||
| import { useDeleteUser } from '@/features/my/apis/useDeleteUser'; | ||
| import { cx } from '@styled-system/css'; | ||
|
|
||
| import * as s from './style.css'; | ||
| import { useState } from 'react'; | ||
|
|
||
| const DeleteAccountButton = () => { | ||
| const { openToast } = useToast(); | ||
| const { mutate: deleteUser } = useDeleteUser(); | ||
| const [showDeleteAlert, setShowDeleteAlert] = useState(false); | ||
|
|
||
| const handleDelete = () => { | ||
| deleteUser(undefined, { | ||
| onSuccess: () => { | ||
| openToast({ message: '회원탈퇴 완료!' }); | ||
|
halionaz marked this conversation as resolved.
|
||
| }, | ||
| }); | ||
| setShowDeleteAlert(false); | ||
| }; | ||
|
|
||
| return ( | ||
| <> | ||
| <button className={s.GoMenu} onClick={() => setShowDeleteAlert(true)}> | ||
| <div className={s.MenuContent}> | ||
| <span className={cx(`mgc_user_x_fill`)} /> | ||
| 회원 탈퇴 | ||
| </div> | ||
| <div className={cx('mgc_right_line', s.Icon)} /> | ||
| </button> | ||
| {showDeleteAlert && ( | ||
| <CustomAlert | ||
| title="회원 탈퇴 후 복구가 불가능해요!" | ||
| subTitle="정말 탈퇴하실 건가요?" | ||
| yesBtn="네, 탈퇴할게요" | ||
| onNo={() => setShowDeleteAlert(false)} | ||
| onYes={handleDelete} | ||
| /> | ||
| )} | ||
| </> | ||
| ); | ||
| }; | ||
| export default DeleteAccountButton; | ||
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.