(WIP) Add initial API client
This commit is contained in:
parent
967f9fc474
commit
faddda83f0
9 changed files with 260 additions and 27 deletions
|
@ -1,18 +1,34 @@
|
|||
import React from 'react'
|
||||
import {Text, Button, View} from 'react-native'
|
||||
import {Text, Button, View, ActivityIndicator} from 'react-native'
|
||||
import {observer} from 'mobx-react-lite'
|
||||
import {Shell} from '../platform/shell'
|
||||
import type {RootTabsScreenProps} from '../routes/types'
|
||||
import {useStores} from '../state'
|
||||
|
||||
export function Login({navigation}: RootTabsScreenProps<'Login'>) {
|
||||
export const Login = observer(({navigation}: RootTabsScreenProps<'Login'>) => {
|
||||
const store = useStores()
|
||||
return (
|
||||
<Shell>
|
||||
<View style={{justifyContent: 'center', alignItems: 'center'}}>
|
||||
<Text style={{fontSize: 20, fontWeight: 'bold'}}>Sign In</Text>
|
||||
<Button title="Login" onPress={() => store.session.setAuthed(true)} />
|
||||
<Button title="Sign Up" onPress={() => navigation.navigate('Signup')} />
|
||||
{store.session.uiError ?? <Text>{store.session.uiError}</Text>}
|
||||
{store.session.uiState === 'idle' ? (
|
||||
<>
|
||||
{store.session.hasAccount ?? (
|
||||
<Button
|
||||
title="Login"
|
||||
onPress={() => store.session.loadAccount()}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
title="Sign Up"
|
||||
onPress={() => navigation.navigate('Signup')}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<ActivityIndicator />
|
||||
)}
|
||||
</View>
|
||||
</Shell>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue