Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/components/CustomConnectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import {
ConnectButton,
useCurrentAccount,
useSuiClientQuery,
useDisconnectWallet,
} from "@mysten/dapp-kit";
import { useState } from "react";
import toast from "react-hot-toast";

export function CustomConnectButton() {
const account = useCurrentAccount();
const { mutate: disconnect } = useDisconnectWallet();
const [isOpen, setIsOpen] = useState(false);

// Fetch balance
Expand Down Expand Up @@ -214,10 +216,9 @@ export function CustomConnectButton() {
{/* Disconnect Button */}
<button
onClick={() => {
// The ConnectButton handles disconnect internally
disconnect();
setIsOpen(false);
// We'll need to use the wallet's disconnect method
window.location.reload();
toast.success("Wallet disconnected");
}}
style={{
width: "100%",
Expand Down