From 4dadbec6e88206fa8e5990588bc15d96eb284217 Mon Sep 17 00:00:00 2001 From: Rinsvent Date: Sun, 9 Apr 2023 00:29:12 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=D0=BB=20=D1=81=D0=BC=D0=B5=D0=BD=D1=83=20=D1=82=D0=BE?= =?UTF-8?q?=D0=BA=D0=B5=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/elements/tokens/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/elements/tokens/index.tsx b/components/elements/tokens/index.tsx index a22a12d..124ae30 100644 --- a/components/elements/tokens/index.tsx +++ b/components/elements/tokens/index.tsx @@ -24,8 +24,7 @@ const style = { }; export default function Tokens() { - const {token, tokens, addToken, deleteToken} = useContext(Context) - const [value, setValue] = useState('') + const {token, tokens, addToken, deleteToken, switchToken} = useContext(Context) const [showAddForm, setShowAddForm] = useState(false) const [showConfirm, setShowConfirm] = useState(false) @@ -38,7 +37,6 @@ export default function Tokens() { setShowAddForm(!token) }, [token]) - console.log('token34344', token); return ( <> @@ -48,9 +46,11 @@ export default function Tokens() { ...token, label: token?.host ?? '' }} - onChange={(event: any, newValue: string | null) => { + onChange={(event: any, newValue: any) => { console.log('newValue', newValue); - setValue(newValue || ''); + if (newValue?.id) { + switchToken(newValue?.id) + } }} disablePortal options={variants}