nyx-dashboard/components/AuthButton.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

import { signIn, signOut, useSession } from 'next-auth/client'
2021-06-27 12:44:22 +02:00
import {Button} from '@chakra-ui/react'
export default function Page() {
const [session, loading] = useSession()
return <>
{!session && <>
2021-06-27 12:44:22 +02:00
<Button
display={{ base: 'none', md: 'inline-flex' }}
fontSize={'sm'}
fontWeight={600}
color={'white'}
bg={'pink.400'}
href={'#'}
_hover={{
bg: 'pink.300',
}}
onClick={()=>signIn()}>
Sign In
</Button>
</>}
{session && <>
2021-06-27 12:44:22 +02:00
<Button
display={{ base: 'none', md: 'inline-flex' }}
fontSize={'sm'}
fontWeight={600}
color={'white'}
bg={'pink.400'}
href={'#'}
_hover={{
bg: 'pink.300',
}}
onClick={() => signOut()}>
Sign Out
</Button>
</>}
</>
}