UNPKG

@web3auth/modal

Version:

Multi chain wallet aggregator for web3Auth

29 lines (26 loc) 631 B
import { useState, useCallback } from 'react'; import { useWeb3AuthInner } from './useWeb3AuthInner.js'; const useWeb3AuthDisconnect = () => { const { web3Auth } = useWeb3AuthInner(); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const disconnect = useCallback(async options => { setLoading(true); setError(null); try { await web3Auth.logout(options); } catch (error) { setError(error); } finally { setLoading(false); } }, [web3Auth]); return { loading, error, disconnect }; }; export { useWeb3AuthDisconnect };