Skip to content

Commit

Permalink
chore: tidy test app, adding request accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Jun 3, 2022
1 parent 5cf51a9 commit 8f519f5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
4 changes: 2 additions & 2 deletions test-app/src/components/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Button, Text, Box, ButtonGroup } from '@stacks/ui';
import { useConnect } from '@stacks/connect-react';
import { OnboardingSelectors } from '@tests/integration/onboarding/onboarding.selectors';

export const Auth: React.FC = () => {
export const JwtAuth: React.FC = () => {
const { doOpenAuth } = useConnect();
return (
<Box>
Expand All @@ -17,7 +17,7 @@ export const Auth: React.FC = () => {
onClick={() => doOpenAuth()}
data-testid={OnboardingSelectors.SignUpBtn}
>
Sign up
JWT Authentication
</Button>
</ButtonGroup>
</Box>
Expand Down
39 changes: 23 additions & 16 deletions test-app/src/components/home.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useContext, useState } from 'react';
import { AppContext } from '@common/context';
import { Box, Text, Flex, BoxProps, Button } from '@stacks/ui';
import { Auth } from './auth';
import { JwtAuth } from './auth';
import { Tab } from './tab';
import { Status } from './status';
import { Counter } from './counter';
Expand Down Expand Up @@ -70,21 +70,28 @@ export const Home: React.FC = () => {
<Text as="h1" textStyle="display.large" fontSize={7} mb={'loose'} display="block">
Testnet Demo
</Text>
{state.userData ? <Page tab={tab} setTab={setTab} /> : <Auth />}
<Button
my="base"
onClick={() => {
// console.log('request accounts app', getStacksProvider());
getStacksProvider()
.request('stx_requestAccounts')
.then(resp => {
setAccount(resp);
console.log('request acct resp', resp);
});
}}
>
Request accounts
</Button>
{state.userData ? (
<Page tab={tab} setTab={setTab} />
) : (
<>
<JwtAuth />
<Button
my="base"
onClick={() => {
// console.log('request accounts app', getStacksProvider());
getStacksProvider()
.request('stx_requestAccounts')
.then(resp => {
setAccount(resp);
console.log('request acct resp', resp);
});
}}
>
Request accounts
</Button>
</>
)}

<Button
my="base"
ml="base"
Expand Down

0 comments on commit 8f519f5

Please sign in to comment.