From 6a23ad8a0ae7e131957aab9de284a4f3d0c20b45 Mon Sep 17 00:00:00 2001 From: Ben Kremer Date: Mon, 14 Feb 2022 13:41:33 +0100 Subject: [PATCH] fix: removes reliance on `session` for Header --- dapps/react-dapp-v2-with-ethers/src/App.tsx | 4 ++-- .../src/components/Header.tsx | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dapps/react-dapp-v2-with-ethers/src/App.tsx b/dapps/react-dapp-v2-with-ethers/src/App.tsx index 316cb8b..24383e8 100644 --- a/dapps/react-dapp-v2-with-ethers/src/App.tsx +++ b/dapps/react-dapp-v2-with-ethers/src/App.tsx @@ -208,7 +208,7 @@ export default function App() { ) : ( -

Accounts

+

Account

{accounts.map(account => { return ( @@ -232,7 +232,7 @@ export default function App() { return ( -
Promise.resolve()} disconnect={disconnect} session={session} /> +
Promise.resolve()} disconnect={disconnect} accounts={accounts} /> {isInitializing ? "Loading..." : renderContent()} diff --git a/dapps/react-dapp-v2-with-ethers/src/components/Header.tsx b/dapps/react-dapp-v2-with-ethers/src/components/Header.tsx index fcf39e2..e65cd44 100644 --- a/dapps/react-dapp-v2-with-ethers/src/components/Header.tsx +++ b/dapps/react-dapp-v2-with-ethers/src/components/Header.tsx @@ -50,18 +50,18 @@ const SActiveSession = styled(SActiveAccount as any)` interface HeaderProps { ping: () => Promise; disconnect: () => Promise; - session: SessionTypes.Created | undefined; + accounts: string[]; } const Header = (props: HeaderProps) => { - const { ping, disconnect, session } = props; + const { ping, disconnect, accounts } = props; return ( - {session ? ( + {accounts.length > 0 ? ( <> -

{`Connected to`}

-

{session.peer.metadata.name}

+

{`Connected with`}

+

{accounts[0]}