Add disconnect functionality to App component

- Introduced a disconnect button that removes the wallet from localStorage and reloads the page when clicked.
- Updated the rendering logic to conditionally display the connect and disconnect buttons based on the connection state.
This commit is contained in:
odiinnn committed 2025-09-30 18:34:31 +03:00
1 parent 8d69cd3d3f
commit f46a4418c9
1 file changed
+6 -2
+6 -2
View File
@@ -22,11 +22,15 @@ function App() {
}
}
const disconnect = async () => {
localStorage.removeItem('VARAN_WALLET');
window.location.reload();
}
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
<button onClick={connect}>Connect</button>
{isConnected && <button onClick={disconnect}>Disconnect</button>}
{!isConnected && <button onClick={connect}>Connect</button>}
<div>Is Connected: {isConnected ? 'Yes' : 'No'}</div>
<button onClick={checkData}>Check Data</button>
<div>DATA</div>