11import Rial from "../../../../../components/Rial" ;
22import Psc from "../../../../../components/Psc" ;
33import Input from "../../../../../components/Input" ;
4- import { getItem } from "../../../../../services/Utility/LocalStorage" ;
54
65import styled from "styled-components" ;
76import { useContext , useState } from "react" ;
@@ -18,7 +17,6 @@ import {
1817import {
1918 calculateFee ,
2019 getFieldTranslationByNames ,
21- persianNumbers ,
2220 ToastError ,
2321 formatNumber ,
2422} from "../../../../../services/Utility" ;
@@ -48,15 +46,13 @@ const ResultWrapper = styled.div`
4846` ;
4947
5048const SellerPriceInfo = ( ) => {
51- const accountSecurity = getItem ( "account_security" ) ?. account_security ;
52-
5349 const [ feature ] = useContext ( FeatureContext ) ;
5450 const [ wallet , dispatch ] = useContext ( WalletContext ) ;
5551 const [ rial , setRial ] = useState ( feature . properties . price_irr ) ;
5652 const [ psc , setPsc ] = useState ( feature . properties . price_psc ) ;
5753 const Navigate = useNavigate ( ) ;
58- const { Request, HTTP_METHOD } = useRequest ( ) ;
59-
54+ const { Request, HTTP_METHOD , checkSecurity } = useRequest ( ) ;
55+
6056 const onSubmit = ( ) => {
6157 try {
6258 const walletPscRaw = wallet ?. psc || 0 ;
@@ -73,10 +69,8 @@ const SellerPriceInfo = () => {
7369 ToastError ( getFieldTranslationByNames ( "1604" ) ) ;
7470 return ;
7571 }
76- if ( ! accountSecurity ) {
77- ToastError ( getFieldTranslationByNames ( "1603" ) ) ;
78- return ;
79- }
72+ if ( ! checkSecurity ( ) ) return ;
73+
8074 Request ( `features/buy/${ feature ?. id } ` , HTTP_METHOD . POST )
8175 . then ( ( response ) => {
8276 dispatch ( {
@@ -107,7 +101,7 @@ const SellerPriceInfo = () => {
107101 onchange = { ( e ) => setRial ( e . target . value ) }
108102 type = "number"
109103 placeholder = { `${ getFieldTranslationByNames (
110- "521"
104+ "521" ,
111105 ) } (${ getFieldTranslationByNames ( "48" ) } )`}
112106 insideText = { < Rial /> }
113107 disabled
@@ -117,7 +111,7 @@ const SellerPriceInfo = () => {
117111 onchange = { ( e ) => setPsc ( e . target . value ) }
118112 type = "number"
119113 placeholder = { `${ getFieldTranslationByNames (
120- "521"
114+ "521" ,
121115 ) } (${ getFieldTranslationByNames ( "47" ) } )`}
122116 insideText = { < Psc /> }
123117 disabled
@@ -127,7 +121,7 @@ const SellerPriceInfo = () => {
127121 < TitleValue
128122 title = { getFieldTranslationByNames ( "522" ) }
129123 value = { `${ calculateFee ( rial , 5 ) } ${ getFieldTranslationByNames (
130- "48"
124+ "48" ,
131125 ) } / ${ calculateFee ( psc , 5 ) } ${ getFieldTranslationByNames ( "47" ) } `}
132126 />
133127 < TitleValue title = { getFieldTranslationByNames ( "523" ) } value = "5%" />
0 commit comments