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

jwt
Rinsvent 1 year ago
parent fbf3c06efd
commit 4dadbec6e8
  1. 10
      components/elements/tokens/index.tsx

@ -24,8 +24,7 @@ const style = {
}; };
export default function Tokens() { export default function Tokens() {
const {token, tokens, addToken, deleteToken} = useContext(Context) const {token, tokens, addToken, deleteToken, switchToken} = useContext(Context)
const [value, setValue] = useState('')
const [showAddForm, setShowAddForm] = useState(false) const [showAddForm, setShowAddForm] = useState(false)
const [showConfirm, setShowConfirm] = useState(false) const [showConfirm, setShowConfirm] = useState(false)
@ -38,7 +37,6 @@ export default function Tokens() {
setShowAddForm(!token) setShowAddForm(!token)
}, [token]) }, [token])
console.log('token34344', token);
return ( return (
<> <>
<Grid container> <Grid container>
@ -48,9 +46,11 @@ export default function Tokens() {
...token, ...token,
label: token?.host ?? '' label: token?.host ?? ''
}} }}
onChange={(event: any, newValue: string | null) => { onChange={(event: any, newValue: any) => {
console.log('newValue', newValue); console.log('newValue', newValue);
setValue(newValue || ''); if (newValue?.id) {
switchToken(newValue?.id)
}
}} }}
disablePortal disablePortal
options={variants} options={variants}

Loading…
Cancel
Save