-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: 관리자 상품 조회 순서 변경 기능 추가 * feat: 관리자 상품 추가 모달에 카테고리 반영 * feat: 관리자 페이지 주문 조회 staleTime 추가 * feat: 관리자 주문 조회 필터 조건 추가(주문 번호, 보내는 분, 받는 분) * design: 관리자 상품 조회 페이지 행 cursor 변경
- Loading branch information
Showing
12 changed files
with
345 additions
and
76 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { adminPatch } from "@apis/api"; | ||
import { QUERY_KEY } from "@apis/queryKeys/queryKeys"; | ||
import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
import { ErrorResponse, MutateResponseType } from "@types"; | ||
|
||
interface PatchProductSequence { | ||
productId: number; | ||
currentSequence: number; | ||
newSequence: number; | ||
} | ||
|
||
const patchProductSequence = async ({ | ||
productId, | ||
currentSequence, | ||
newSequence, | ||
}: PatchProductSequence): Promise<MutateResponseType> => { | ||
try { | ||
const response = await adminPatch<MutateResponseType>( | ||
`api/v1/product/sequence/${productId.toString()}?currentSequence=${currentSequence}&newSequence=${newSequence}` | ||
); | ||
return response.data; | ||
} catch (error) { | ||
const errorResponse = error as ErrorResponse; | ||
const errorData = errorResponse.response.data; | ||
throw errorData; | ||
} | ||
}; | ||
|
||
export const usePatchSequence = () => { | ||
const queryClient = useQueryClient(); | ||
return useMutation({ | ||
mutationFn: ({ | ||
productId, | ||
currentSequence, | ||
newSequence, | ||
}: PatchProductSequence) => | ||
patchProductSequence({ productId, currentSequence, newSequence }), | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ queryKey: [QUERY_KEY.PRODUCT_LIST_ALL] }); | ||
}, | ||
}); | ||
}; |
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.