PortainerManager/app/index.tsx

37 lines
905 B
TypeScript

import { Text, View } from "react-native";
import LoginForm from "./components/LoginForm";
import { AuthProvider } from "./context/AuthContext";
import { useAuth } from "./context/AuthContext";
export default function Index() {
return (
<AuthProvider>
<View style={{ flex: 1, padding: 16, width: '100%' }}>
<MainContent />
</View>
</AuthProvider>
);
}
function MainContent() {
const { isAuthenticated, domain, username, authData } = useAuth();
if (!isAuthenticated) {
return (
<View style={{ flex: 1, padding: 16, width: '100%' }}>
<LoginForm />
</View>
);
}
return (
<View style={{ flex: 1, padding: 16, width: '100%' }}>
<Text>Connected to: {domain}</Text>
<Text>User: {username}</Text>
<Text>Debug authData: {JSON.stringify(authData, null, 2)}</Text>
{/* Use authData as needed */}
</View>
);
}