Skip to content

Commit

Permalink
handle disconnect not fixed yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonath-z committed Aug 20, 2022
1 parent 32012e8 commit 5fef3c4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions components/modules/__secured/ProfileMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import truncateAddress from "@lib/helper/truncateAddress";
import { useRouter } from "next/router";
import UserAvatarCard from "@components/modules/__modules__/Card/UserAvatarCard";
import { UserAccount } from "@lib/models/UserAccount";
import { web3Actions } from "@lib/web3";

const ProfileMenu = () => {
const currentAccount = useRecoilValue(currentAccountState);
Expand All @@ -34,6 +35,10 @@ const ProfileMenu = () => {
setIsProfileMenu(!isProfileMenu);
};

const onLogout = async () => {
await web3Actions.disconnectBrowserWallet();
};

return (
<div
className={`${
Expand Down Expand Up @@ -87,6 +92,12 @@ const ProfileMenu = () => {
</span>
</button>
</div>
<button
onClick={onLogout}
className="border rounded-xl py-3 hover:border-gray-400 font-bold transition-all"
>
Log out
</button>
</div>
</div>
);
Expand Down
6 changes: 6 additions & 0 deletions lib/web3/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ class Web3Actions {
}
}

public async disconnectBrowserWallet() {
await web3Services.disconnect();

LocalStorage.removeItem("ongama_signer_address");
}

public async connectTrustOrConnectWallet() {
let signer;
try {
Expand Down
4 changes: 4 additions & 0 deletions lib/web3/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class Web3Service {
return walletAddress;
}

public async disconnect() {
//handle disconnect
}

public async coinBaseConnect() {
const connectCoinbaseWallet = await connectCoinbase();
return connectCoinbaseWallet;
Expand Down

0 comments on commit 5fef3c4

Please sign in to comment.