mirror of
https://github.com/aljazceru/react-native-pubky.git
synced 2025-12-18 23:24:22 +01:00
Add base project
Implement auth method
This commit is contained in:
37
example/src/App.tsx
Normal file
37
example/src/App.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import { StyleSheet, View, Button } from 'react-native';
|
||||
import { auth } from 'react-native-pubky';
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Button
|
||||
title={'auth'}
|
||||
onPress={async (): Promise<void> => {
|
||||
try {
|
||||
const res = await auth('pubkyAuthUrl', 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855');
|
||||
if (res.isErr()) {
|
||||
console.log(res.error.message);
|
||||
return;
|
||||
}
|
||||
console.log(res.value);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
box: {
|
||||
width: 60,
|
||||
height: 60,
|
||||
marginVertical: 20,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user