(WIP) Add initial API client
This commit is contained in:
parent
967f9fc474
commit
faddda83f0
9 changed files with 260 additions and 27 deletions
|
@ -1,24 +1,36 @@
|
|||
import React from 'react'
|
||||
import {Text, Button, View, ActivityIndicator} from 'react-native'
|
||||
import {observer} from 'mobx-react-lite'
|
||||
import {Shell} from '../platform/shell'
|
||||
import {Text, Button, View} from 'react-native'
|
||||
import type {RootTabsScreenProps} from '../routes/types'
|
||||
import {useStores} from '../state'
|
||||
|
||||
export function Signup({navigation}: RootTabsScreenProps<'Signup'>) {
|
||||
const store = useStores()
|
||||
return (
|
||||
<Shell>
|
||||
<View style={{justifyContent: 'center', alignItems: 'center'}}>
|
||||
<Text style={{fontSize: 20, fontWeight: 'bold'}}>Create Account</Text>
|
||||
<Button
|
||||
title="Create new account"
|
||||
onPress={() => store.session.setAuthed(true)}
|
||||
/>
|
||||
<Button
|
||||
title="Log in to an existing account"
|
||||
onPress={() => navigation.navigate('Login')}
|
||||
/>
|
||||
</View>
|
||||
</Shell>
|
||||
)
|
||||
}
|
||||
export const Signup = observer(
|
||||
({navigation}: RootTabsScreenProps<'Signup'>) => {
|
||||
const store = useStores()
|
||||
return (
|
||||
<Shell>
|
||||
<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' ? (
|
||||
<>
|
||||
<Button
|
||||
title="Create new account"
|
||||
onPress={() =>
|
||||
store.session.createTestAccount('http://localhost:1986')
|
||||
}
|
||||
/>
|
||||
<Button
|
||||
title="Log in to an existing account"
|
||||
onPress={() => navigation.navigate('Login')}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<ActivityIndicator />
|
||||
)}
|
||||
</View>
|
||||
</Shell>
|
||||
)
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue