Move LoginProvider to component/sesyon & improve it
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import Link from 'next/link'
|
||||
import {signIn} from 'next-auth/client'
|
||||
import {Button} from '@material-ui/core'
|
||||
|
||||
export default function LoginProvider({id, title, icon, callbackUrl}) {
|
||||
const hanleClick = event => {
|
||||
event.preventDefault()
|
||||
signIn(id, {
|
||||
callbackUrl
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<Link href='/api/auth/signin'>
|
||||
<Button
|
||||
variant='contained'
|
||||
color='primary'
|
||||
startIcon={icon}
|
||||
onClick={hanleClick}
|
||||
>
|
||||
{title} koneksyon
|
||||
</Button>
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
|
||||
LoginProvider.propTypes = {
|
||||
id: PropTypes.string.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
icon: PropTypes.node.isRequired,
|
||||
callbackUrl: PropTypes.string.isRequired
|
||||
}
|
||||
Reference in New Issue
Block a user