Add base auth & ucan request flow (web only)

This commit is contained in:
Paul Frazee 2022-06-14 14:29:47 -05:00
parent 09b78a4634
commit cef133031e
14 changed files with 1555 additions and 290 deletions

View file

@ -14,7 +14,7 @@ export function Home({navigation}: RootTabsScreenProps<'Home'>) {
title="Go to Jane's profile"
onPress={() => navigation.navigate('Profile', {name: 'Jane'})}
/>
<Button title="Logout" onPress={() => store.session.setAuthed(false)} />
<Button title="Logout" onPress={() => store.session.logout()} />
</View>
</Shell>
)

View file

@ -12,14 +12,9 @@ export const Login = observer(({navigation}: RootTabsScreenProps<'Login'>) => {
<View style={{justifyContent: 'center', alignItems: 'center'}}>
<Text style={{fontSize: 20, fontWeight: 'bold'}}>Sign In</Text>
{store.session.uiError ?? <Text>{store.session.uiError}</Text>}
{store.session.uiState === 'idle' ? (
{!store.session.uiIsProcessing ? (
<>
{store.session.hasAccount ?? (
<Button
title="Login"
onPress={() => store.session.loadAccount()}
/>
)}
<Button title="Login" onPress={() => store.session.login()} />
<Button
title="Sign Up"
onPress={() => navigation.navigate('Signup')}

View file

@ -13,13 +13,11 @@ export const Signup = observer(
<View style={{justifyContent: 'center', alignItems: 'center'}}>
<Text style={{fontSize: 20, fontWeight: 'bold'}}>Create Account</Text>
{store.session.uiError ?? <Text>{store.session.uiError}</Text>}
{store.session.uiState === 'idle' ? (
{!store.session.uiIsProcessing ? (
<>
<Button
title="Create new account"
onPress={() =>
store.session.createTestAccount('http://localhost:1986')
}
onPress={() => store.session.login()}
/>
<Button
title="Log in to an existing account"