-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 거래시점에 거래량 존재하지 않아 미체결로 분류된 주문 관련하여 주문 취소 기능 구현 - 취소 의사 이중 확인을 위한 모달창 필요한 상황이나, BE 담당자와 API 관련 추가 논의 후 확정되면 추가로 구현할 예정임 Issues #17
- Loading branch information
1 parent
91c32ad
commit 3838840
Showing
9 changed files
with
268 additions
and
63 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,32 @@ | ||
import { useMutation, useQueryClient } from "react-query"; | ||
import axios from "axios"; | ||
|
||
const url = "http://ec2-13-125-246-160.ap-northeast-2.compute.amazonaws.com:8080/stock/stockorders/"; | ||
|
||
const useDeleteStockOrder = () => { | ||
const queryClient = useQueryClient(); | ||
|
||
const mutate = useMutation((orderId: number) => deleteStockOrder(orderId), { | ||
onSuccess: () => { | ||
queryClient.invalidateQueries("holdingStock"); | ||
queryClient.invalidateQueries("orderRecord"); | ||
}, | ||
}); | ||
|
||
return mutate; | ||
}; | ||
|
||
export default useDeleteStockOrder; | ||
|
||
const deleteStockOrder = async (orderId: number) => { | ||
const authToken = localStorage.getItem("authToken"); | ||
const options = { | ||
headers: { | ||
Authorization: `${authToken}`, | ||
"Content-Type": "application/json", | ||
}, | ||
}; | ||
|
||
const response = await axios.delete(`${url}${orderId}`, options); | ||
return response; | ||
}; |
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.