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}