-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: 목표 생성, 목표 상세보기, 목표 삭제 후 현재 페이지 변경 로직 추가 #115
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b01b274
feat: 목표 생성, 목표 상세보기, 목표 삭제 후 현재 페이지 변경 로직 추가
deepbig 5443f65
feat: conflict 해결 시 빠진 코드 추가
deepbig 8f7b51c
Merge branch 'feat/home-position-after-goal-detail-saved' of https://…
deepbig 1e5c12c
fix: rebase 과정에서 중복 추갇된 코드 삭제
deepbig 1102c96
fix: rebase 반영 시 빠진 코드 추가
deepbig 0911505
feat: 페이지 이동 버그 수정
deepbig 9b3a670
feat: 피드백 반영
deepbig 35028fd
bug: 처음 로그인 시 token 값 확인 못하는 문제 해결
deepbig 7316559
bug: 신규 유저 생성 후 redirection 문제 해결
deepbig 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 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
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
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
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
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,16 +1,23 @@ | ||
import { useRouter } from 'next/navigation'; | ||
import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
|
||
import { api } from '@/apis'; | ||
import type { MemberProps } from '@/features/member/types'; | ||
|
||
type GoalRequestParams = { | ||
goalId: number; | ||
}; | ||
|
||
export const useDeleteGoal = () => { | ||
const queryClient = useQueryClient(); | ||
const router = useRouter(); | ||
|
||
return useMutation({ | ||
mutationFn: (data: GoalRequestParams) => api.delete(`/goal/${data.goalId}`), | ||
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['goals'] }), | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ queryKey: ['goals'] }); | ||
const memberData = queryClient.getQueryData(['memberData']) as MemberProps; | ||
router.push(`/home/${memberData.username}`); | ||
}, | ||
}); | ||
}; |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
positionState.positionPage === page && positionState.position
이거 뭘 의미하는지 한번 상수로 만들어준 다음에 넣어주실 수 있나영 ? 나중에 여기 리팩터링 제가 맡으면 눈물 한번 흘리고 시작할 거 같아서 😭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
positionSate.position
체크 로직은 뒤의 컴포넌트 출력 시 null 체크를 먼저 하려고 추가된 거에요. 별도 함수로 빼서 로직을 생성하면 결국은 앞의positionState.positionPage === page
만 남는데 이게 의미가 있을까~??[도은 피드백 적용 후]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
일단 나중에 도은이가 리팩토링 작업할 때 이해 안될 수도 있으니까 comment로 설명 적어뒀어요~~~~!