Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
H34D committed Nov 15, 2022
1 parent 30d6e10 commit 17fc747
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions src/common/components/masa-interface/index.tsx
Expand Up @@ -28,25 +28,12 @@ export const MasaInterface = () => {
const page = useMemo(() => {
console.log({ loading, isConnected, identity, loggedIn });

switch (true) {
case !isConnected:
return 'connector';
if (!isConnected) return 'connector';
if (!loggedIn) return 'authenticate';
if (!identity && scope?.includes('identity')) return 'createIdentity';
if (isConnected && loggedIn) return 'connectedState';

case !loggedIn:
return 'authenticate';

// @ts-ignore
case !identity:
if (scope?.includes('identity')) return 'createIdentity';
// todo this cant be correct, but otherwise i will get a typescript error
return '';

case isConnected && loggedIn:
return 'connectedState';

default:
return 'connector';
}
return 'connector';
}, [loading, isConnected, identity, loggedIn, scope]);

return (
Expand Down

0 comments on commit 17fc747

Please sign in to comment.