diff --git a/client/src/components/StockOrderSection/StockOrder.tsx b/client/src/components/StockOrderSection/StockOrder.tsx index 7d1049e3..9dac79a4 100644 --- a/client/src/components/StockOrderSection/StockOrder.tsx +++ b/client/src/components/StockOrderSection/StockOrder.tsx @@ -73,8 +73,8 @@ const StockOrder = ({ corpName }: { corpName: string }) => { // 주문 실패 케이스 1) 개장시간 2) 가격/거래량 설정 // 🔴 3시 30분 이후 작업 위해 closingTime 조건 해제 - // const orderFailureCase01 = nonBusinessDay; - const orderFailureCase01 = nonBusinessDay || closingTime; + const orderFailureCase01 = nonBusinessDay; + // const orderFailureCase01 = nonBusinessDay || closingTime; const orderFailureCase02 = orderPrice === 0 || orderVolume === 0; return ( diff --git a/client/src/hooks/useGetStockOrderRecord.ts b/client/src/hooks/useGetStockOrderRecord.ts index 961b38d9..e5b7d056 100644 --- a/client/src/hooks/useGetStockOrderRecord.ts +++ b/client/src/hooks/useGetStockOrderRecord.ts @@ -7,7 +7,7 @@ const url = "http://ec2-13-125-246-160.ap-northeast-2.compute.amazonaws.com:8080 const useGetStockOrderRecord = () => { const isLogin = useSelector((state: StateProps) => state.login); - const { data, isLoading, isError } = useQuery("record", getOrderRecord, { + const { data, isLoading, isError } = useQuery("orderRecord", getOrderRecord, { enabled: isLogin === 1, }); diff --git a/client/src/hooks/useTradeStock.ts b/client/src/hooks/useTradeStock.ts index 4aeb06b2..5665cfd1 100644 --- a/client/src/hooks/useTradeStock.ts +++ b/client/src/hooks/useTradeStock.ts @@ -1,6 +1,6 @@ import { useSelector } from "react-redux"; import { StateProps } from "../models/stateProps"; -import { useMutation } from "react-query"; +import { useMutation, useQueryClient } from "react-query"; import axios from "axios"; const useTradeStock = () => { @@ -9,7 +9,14 @@ const useTradeStock = () => { const orderPrice = useSelector((state: StateProps) => state.stockOrderPrice); const orderVolume = useSelector((state: StateProps) => state.stockOrderVolume); - const orderRequest = useMutation(() => postOrderRequest(orderType, companyId, orderPrice, orderVolume)); + const queryClient = useQueryClient(); + const orderRequest = useMutation(() => postOrderRequest(orderType, companyId, orderPrice, orderVolume), { + onSuccess: () => { + queryClient.invalidateQueries("cash"); + queryClient.invalidateQueries("holdingStock"); + queryClient.invalidateQueries("orderRecord"); + }, + }); return orderRequest; };