import React from 'react'
import PropTypes from 'prop-types'
import { BannerTopBar } from '../../common'
import SignupForm from './SignupForm'
export class SignupVerifyResponse extends React.Component {
componentDidMount () {
const { mutate } = this.props
mutate()
}
render () {
const { loading, error, data } = this.props
let BannerTitle = ''
let BannerText = ''
let displayForm = false
console.log('SignupVerifyResponse:', loading, error, data)
if (error) {
if (
error.message ===
'GraphQL error: Error: Token Expired. Please resubmit email address.'
) {
BannerText = [
Newsletter Signup Error: Verification Token Expired
,
,
'Please resubmit your email address and a new token will be emailed to you.',
,
' We apologize for the inconvenience, but we highly value your seurity and privacy.'
]
displayForm = true
} else {
BannerText = [
'Newsletter Signup Error: ',
,
error.message
]
}
return (
)
}
if (loading && !error) {
BannerText = [
'Processing newsletter sign-up...',
,
'Thank you for opting-in to recieve updates about the Superalgos project!'
]
}
if (data !== undefined && data !== null) {
console.log(data)
if (data.notifications_Master_NewsletterSignupVerify === 'SUCCESS') {
return (
{displayForm && }
)
}
} else {
return (
)
}
}
}
SignupVerifyResponse.propTypes = {
mutate: PropTypes.function,
loading: PropTypes.bool,
error: PropTypes.object,
data: PropTypes.object
}
export default SignupVerifyResponse