do not ask user for currency scale

This commit is contained in:
Bilal
2020-10-06 15:34:54 +03:00
parent 7458cd3b75
commit cb01467900

View File

@@ -6,7 +6,6 @@ import {Button, Select, TextInput} from "react-materialize";
const ChipSelection = (props) => {
const [chips, setChips] = useState([]);
const [selectedChip, setSelectedChip] = useState('1');
const [chipScale, setChipScale] = useState('2');
useEffect(() => {
(async() => {
@@ -26,7 +25,7 @@ const ChipSelection = (props) => {
const chipsToOptions = chips.map( (chip, index) => <option key={index} value={chip.id}>{`${chip.code}${chip.name}`}</option>);
const disableSubmit = () => {
return !((parseInt(selectedChip) > 0) && (parseInt(chipScale) > 0));
return !(parseInt(selectedChip) > 0);
}
const handleSubmit = async () => {
@@ -37,7 +36,7 @@ const ChipSelection = (props) => {
chip_code: chipData.code,
chip_symbol: chipData.symbol,
chip_prefixed: chipData.prefixed,
chip_scale: parseInt(chipScale)
chip_scale: chipData.scale
}
try{
@@ -61,14 +60,6 @@ const ChipSelection = (props) => {
{ chipsToOptions }
</Select>
<TextInput
id='chipScale'
label="Chip scale"
value={chipScale}
type='number'
onChange={(e) => setChipScale(e.target.value)}
/>
<Button disabled={disableSubmit()} waves="light" onClick={handleSubmit}>
Do It
</Button>