From 6448fb1bb479c1ceab799a9f42d5ed0a211c6564 Mon Sep 17 00:00:00 2001 From: sync Date: Fri, 27 Sep 2024 15:25:28 +0300 Subject: [PATCH] Fix payer bank accounts combobox. --- src/{App.css => Form.css} | 0 src/{App.jsx => Form.jsx} | 13 ++++++++++--- src/main.jsx | 9 ++------- 3 files changed, 12 insertions(+), 10 deletions(-) rename src/{App.css => Form.css} (100%) rename src/{App.jsx => Form.jsx} (93%) diff --git a/src/App.css b/src/Form.css similarity index 100% rename from src/App.css rename to src/Form.css diff --git a/src/App.jsx b/src/Form.jsx similarity index 93% rename from src/App.jsx rename to src/Form.jsx index 317d661..6971550 100644 --- a/src/App.jsx +++ b/src/Form.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import './App.css'; +import './Form.css'; function App() { const [payerName, setPayerName] = useState(''); @@ -9,6 +9,7 @@ function App() { const [clientId, setClientId] = useState(''); const [payerBankAccount, setPayerBankAccount] = useState(''); const [amount, setAmount] = useState('0-00'); + const [payerAccounts, setPayerAccounts] = useState([]); const handleBlur = () => { console.log(amount); @@ -37,7 +38,6 @@ function App() { action: 'getClientInfo', }), }); - const data = await response.json(); setPayerName(data.fields[3].value); setPayerINN(data.fields[4].value); @@ -45,6 +45,7 @@ function App() { setPayerAddress(data.fields[7].value); setClientId(data.fields[1].value); setPayerBankAccount(data.fields[12].value); + setPayerAccounts(data.accounts); }; fetchUsingAsyncAwaitWithFetchApi(); @@ -73,7 +74,13 @@ function App() { onChange={(e) => setPayerBankAccount(e.target.value)} onBlur={handleBlur} > - + {payerAccounts.map((item, ind) => ( + + ))}
ИНН:
diff --git a/src/main.jsx b/src/main.jsx index 224ec06..fe2c7b8 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -1,9 +1,4 @@ -import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; -import App from './App.jsx'; +import Form from './Form.jsx'; -createRoot(document.getElementById('root')).render( - - - -); +createRoot(document.getElementById('root')).render(
);