Skip to content

Commit

Permalink
AAI (#1039)
Browse files Browse the repository at this point in the history
  • Loading branch information
rschlaefli authored Sep 12, 2019
1 parent 548c89d commit bc500f2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/graphql/queries/CheckAccountStatusQuery.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
query CheckAccountStatus {
checkAccountStatus
}
29 changes: 29 additions & 0 deletions src/pages/entrypoint.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React, { useEffect } from 'react'
import { useRouter } from 'next/router'
import { useQuery } from '@apollo/react-hooks'
import { Message } from 'semantic-ui-react'

import useLogging from '../lib/hooks/useLogging'
import CheckAccountStatusQuery from '../graphql/queries/CheckAccountStatusQuery.graphql'

function Entrypoint(): React.ReactElement {
useLogging()

const router = useRouter()

const { data, error } = useQuery(CheckAccountStatusQuery)

useEffect((): void => {
if (data && data.checkAccountStatus) {
router.push('/questions')
}
}, [data])

if (error) {
return <Message error>{error.message}</Message>
}

return null
}

export default Entrypoint

0 comments on commit bc500f2

Please sign in to comment.