2017-06-30 22:18:11 +02:00
|
|
|
import React from 'react'
|
|
|
|
import Link from 'next/link'
|
|
|
|
|
|
|
|
import redirect from '../lib/redirect'
|
2017-11-02 17:56:14 +01:00
|
|
|
import checkLoggedIn from '../lib/checkLoggedIn'
|
2017-06-30 22:18:11 +02:00
|
|
|
|
2018-03-31 08:11:36 +02:00
|
|
|
import RegisterBox from '../components/RegisterBox'
|
|
|
|
|
2018-05-18 10:55:12 +02:00
|
|
|
export default class CreateAccount extends React.Component {
|
|
|
|
static async getInitialProps (context) {
|
|
|
|
const { loggedInUser } = await checkLoggedIn(context.apolloClient)
|
2017-06-30 22:18:11 +02: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 12:13:56 +02:00
|
|
|
<React.Fragment>
|
2018-03-31 08:11:36 +02:00
|
|
|
{/* RegisterBox handles all register logic. */}
|
2018-05-21 12:13:56 +02:00
|
|
|
<RegisterBox />
|
2017-06-30 22:18:11 +02:00
|
|
|
<hr />
|
2018-12-17 17:34:32 +01:00
|
|
|
Already have an account?{' '}
|
|
|
|
<Link prefetch href='/signin'>
|
|
|
|
<a>Sign in</a>
|
|
|
|
</Link>
|
2018-05-21 12:13:56 +02:00
|
|
|
</React.Fragment>
|
2017-06-30 22:18:11 +02:00
|
|
|
)
|
|
|
|
}
|
2018-12-17 17:34:32 +01:00
|
|
|
}
|