Skip to content

Commit

Permalink
fix: set input price if market selected
Browse files Browse the repository at this point in the history
  • Loading branch information
EchoDex committed Feb 20, 2024
1 parent 5ef4d1e commit 409d347
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ComponentProps, useState } from "react";
import React, { ComponentProps, useEffect, useState } from "react";
import styled from "@emotion/styled";
import { Accordion } from "@szhsin/react-accordion";
import { observer } from "mobx-react";
Expand Down Expand Up @@ -49,6 +49,12 @@ const CreateOrderSpot: React.FC<IProps> = observer(({ ...rest }) => {

const [orderType, setOrderType] = useState(ORDER_OPTIONS[0].key);

useEffect(() => {
if (orderType === ORDER_TYPE.Market) {
vm.setInputPrice(market?.price ?? BN.ZERO);
}
});

if (!market) return null;

const { baseToken, quoteToken } = market;
Expand Down

0 comments on commit 409d347

Please sign in to comment.