import React , { FunctionComponent , useState } from "react" ; import { graphql } from "react-relay" ; import { withFragmentContainer } from "coral-framework/lib/relay" ; import { ForgotPasswordContainer_viewer } from "coral-auth/__generated__/ForgotPasswordContainer_viewer.graphql" ; import CheckEmail from "./CheckEmail" ; import ForgotPasswordForm from "./ForgotPasswordForm" ; interface Props { viewer : ForgotPasswordContainer_viewer | null ; } const ForgotPasswordContainer = ( { viewer } ) => { const [ checkEmail , setCheckEmail ] = useState < string | null > ( null ) ; const email = viewer ? viewer . email : null ; return checkEmail ? ( < CheckEmail email = { checkEmail } / > ) : ( < ForgotPasswordForm email = { email } onCheckEmail = { setCheckEmail } / > ) ; } ; const enhanced = withFragmentContainer < Props > ( { viewer : graphql `
    fragment ForgotPasswordContainer_viewer on User {
      email
    }
  ` , } ) ( ForgotPasswordContainer ) ; export default enhanced ;