2017-06-30 20:18:11 +00:00
|
|
|
import React from 'react'
|
|
|
|
import Link from 'next/link'
|
|
|
|
|
|
|
|
import redirect from '../lib/redirect'
|
2017-11-02 16:56:14 +00:00
|
|
|
import checkLoggedIn from '../lib/checkLoggedIn'
|
2017-06-30 20:18:11 +00:00
|
|
|
|
2018-03-31 06:11:36 +00:00
|
|
|
import RegisterBox from '../components/RegisterBox'
|
|
|
|
|
2018-05-18 08:55:12 +00:00
|
|
|
export default class CreateAccount extends React.Component {
|
|
|
|
static async getInitialProps (context) {
|
|
|
|
const { loggedInUser } = await checkLoggedIn(context.apolloClient)
|
2017-06-30 20:18:11 +00:00
|
|
|
|
|
|
|
if (loggedInUser.user) {
|
|
|
|
// Already signed in? No need to continue.
|
|
|
|
// Throw them back to the main page
|
|
|
|
redirect(context, '/')
|
|
|
|
}
|
|
|
|
|
|
|
|
return {}
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
return (
|
2018-05-21 10:13:56 +00:00
|
|
|
<React.Fragment>
|
2018-03-31 06:11:36 +00:00
|
|
|
{/* RegisterBox handles all register logic. */}
|
2018-05-21 10:13:56 +00:00
|
|
|
<RegisterBox />
|
2017-06-30 20:18:11 +00:00
|
|
|
<hr />
|
2018-12-17 16:34:32 +00:00
|
|
|
Already have an account?{' '}
|
|
|
|
<Link prefetch href='/signin'>
|
|
|
|
<a>Sign in</a>
|
|
|
|
</Link>
|
2018-05-21 10:13:56 +00:00
|
|
|
</React.Fragment>
|
2017-06-30 20:18:11 +00:00
|
|
|
)
|
|
|
|
}
|
2018-12-17 16:34:32 +00:00
|
|
|
}
|