Moved from axios to Fetch API, Added user object to the AuthState

This commit is contained in:
2024-05-08 16:31:21 +02:00
parent 89075eb6ae
commit 8e25ca5dd7
3 changed files with 64 additions and 27 deletions

View File

@ -3,11 +3,13 @@ import { Text, View } from "react-native";
import { useAuth } from "../context/AuthContext";
export default function Index() {
const { onLogout } = useAuth();
const user = "debil"
const { onLogout, authState } = useAuth();
const user = authState.user;
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Text>Welcome {user}</Text>
<Text>Welcome {user.username}</Text>
<Text
onPress={() => {
// The `app/(app)/_layout.tsx` will redirect to the sign-in screen.