Доработал смену токена

jwt
Rinsvent 2 years ago
parent fbf3c06efd
commit 4dadbec6e8
  1. 10
      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 (
<>
<Grid container>
@ -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}

Loading…
Cancel
Save