railbird-gql/component/buttons/sign-out.tsx

18 lines
454 B
TypeScript

import { handleSignOut } from "../../auth"
import { useAuthHeader } from "../../graphql/client"
import React from "react"
import { Button } from "react-native"
export default function SignOutButton(): React.JSX.Element {
const { setAuthHeader } = useAuthHeader()
return (
<Button
title={'Sign out'}
onPress={async () => {
setAuthHeader({ key: 'Authorization', value: '' })
await handleSignOut()
}}
/>
)
}