2024-03-24 23:41:23 +01:00
|
|
|
import { Text } from "react-native"
|
2024-03-22 23:41:51 +01:00
|
|
|
import { Button } from "react-native-paper"
|
|
|
|
import { SafeAreaView } from "react-native-safe-area-context"
|
|
|
|
|
|
|
|
import { useAuthentication } from "@/presentation/react/contexts/Authentication"
|
|
|
|
|
|
|
|
const SettingsPage: React.FC = () => {
|
|
|
|
const { logout, authenticationPresenter } = useAuthentication()
|
|
|
|
|
|
|
|
const handleLogout = async (): Promise<void> => {
|
|
|
|
await authenticationPresenter.logout()
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2024-03-24 23:41:23 +01:00
|
|
|
<SafeAreaView
|
|
|
|
style={[
|
|
|
|
{
|
|
|
|
flex: 1,
|
|
|
|
alignItems: "center",
|
|
|
|
justifyContent: "center",
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
>
|
2024-03-22 23:41:51 +01:00
|
|
|
<Text>Settings</Text>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
mode="contained"
|
|
|
|
onPress={handleLogout}
|
|
|
|
loading={logout.state === "loading"}
|
|
|
|
disabled={logout.state === "loading"}
|
|
|
|
>
|
|
|
|
Logout
|
|
|
|
</Button>
|
|
|
|
</SafeAreaView>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SettingsPage
|