No Description

HomeScreen.js 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import * as React from 'react';
  2. import { Button, View } from 'react-native';
  3. import * as SecureStore from 'expo-secure-store';
  4. import Axios from 'axios';
  5. import Logout from './Logout'
  6. function HomeScreen({ navigation }) {
  7. const credentials = async ()=>{
  8. const token = await SecureStore.getItemAsync('token')
  9. const id = await SecureStore.getItemAsync('id')
  10. console.log(token, id)
  11. let response = await Axios({
  12. url: 'http://481cb6e289f9.ngrok.io/api/hello',
  13. method: 'GET',
  14. headers: {
  15. Authorization: `Token ${token}`
  16. }
  17. })
  18. console.log(response.data.msg)
  19. }
  20. return (
  21. <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
  22. {/* <Text>Welcome to Companion App!</Text> */}
  23. <Button
  24. onPress={() => navigation.navigate('Notifications')}
  25. title="Go to notifications"
  26. />
  27. <Button
  28. onPress={credentials}
  29. title="Prueba"
  30. />
  31. </View>
  32. );
  33. }
  34. export default HomeScreen