-
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] Task 상태 수정 api (드래그앤드롭 부분 우선 구현) #192
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
938d8f0
feat: api axios 생성
Kjiw0n 9ca9a4d
refactor: task 드래그앤드롭을 위한 api 연결 위치 및 props 조정
Kjiw0n b0a28d9
refactor: api 연결 시 화면 깜빡임 최소화를 위해 placeholderData 지정
Kjiw0n e9800e0
refactor: api 설정 개선(타입 설정 등)
Kjiw0n 69d8699
feat: 드래그앤드롭 api 연결 및 useMutation을 통한 자동 리스트 변경
Kjiw0n c4abb33
refactor: 사용하지 않는 변수 제거
Kjiw0n ea0ff13
feat: 리스트 get 쿼리에 placeholderData 디폴트값 추가
Kjiw0n ac7ce3f
refactor: 리엑트쿼리 사용 부분 따로 분리
Kjiw0n 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { TaskType } from '@/types/tasks/taskType'; | ||
|
||
export interface GetTasksResponse { | ||
code: string; | ||
data: { | ||
tasks: TaskType[]; | ||
}; | ||
message: string | null; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface UpdateTaskStatusType { | ||
taskId: number; | ||
targetDate?: string | null; | ||
status?: string | null; | ||
} |
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,12 @@ | ||
import { UpdateTaskStatusType } from './UpdateTaskStatusType'; | ||
|
||
import { privateInstance } from '@/apis/instance'; | ||
|
||
const updateTaskStatus = async ({ taskId, targetDate, status }: UpdateTaskStatusType) => { | ||
await privateInstance.patch(`/api/tasks/${taskId}/status`, { | ||
targetDate, | ||
status, | ||
}); | ||
}; | ||
|
||
export default updateTaskStatus; |
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 { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
|
||
import updateTaskStatus from './axios'; | ||
import { UpdateTaskStatusType } from './UpdateTaskStatusType'; | ||
|
||
const useUpdateTaskStatus = () => { | ||
const queryClient = useQueryClient(); | ||
|
||
const mutation = useMutation({ | ||
mutationFn: (updateData: UpdateTaskStatusType) => updateTaskStatus(updateData), | ||
onSuccess: () => queryClient.invalidateQueries({ queryKey: ['today'] }), | ||
}); | ||
|
||
return { mutate: mutation.mutate, queryClient }; | ||
}; | ||
|
||
export default useUpdateTaskStatus; |
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
Oops, something went wrong.
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.
옵셔널로 해주고 또 null까지 처리해주신 이유가 뭔가용?-? (진짜 몰라서 그럼,,)