@@ -16,11 +16,13 @@ const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingCompo
const AuthWrapper = Loadable(lazy(() => import('./AuthWrapperCustom')));
import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined';
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
import {FormattedMessage} from "react-intl";
export default function Verify() {
const [isLoading, setIsLoading] = useState(true)
/** null: loading; true: verified; false: API returned false (informational); 'error': network or unexpected */
const [verifyState, setVerifyState] = useState(null)
const [enterUseEffect, setEnterUseEffect] = useState(false)
@@ -32,18 +34,20 @@ export default function Verify() {
email: decodeURIComponent(params.email),
emailVerifyHash: decodeURIComponent(params.verifyCode)
}
}).then(
} ).then(
(response)=>{
if (response.status === 200 && response.data) {
if (response.status === 200 && response.data === true ) {
setVerifyState(true)
} else {
} else if (response.status === 200 && response.data === false) {
setVerifyState(false)
} else {
setVerifyState('error')
}
setIsLoading(false)
}
).catch(error => {
console.log(error)
setVerifyState(false )
setVerifyState('error' )
setIsLoading(false)
});
@@ -70,7 +74,7 @@ export default function Verify() {
</Grid>
</Grid> :
<Grid item xs={12}>
{verifyState ?
{verifyState === true ?
// SUCCESS page
<Stack mt={1} direction="column" justifyContent="flex-start" alignItems="center" spacing={2}>
<CheckCircleOutlineIcon color="success" sx={{ width: "200px", height: "200px" }} />
@@ -83,10 +87,22 @@ export default function Verify() {
</Typography>
</Button>
</Stack>
: verifyState === false ?
// Informational (verification not completed via this link)
<Stack mt={1} direction="column" justifyContent="flex-start" alignItems="center" spacing={2}>
<InfoOutlinedIcon color="info" sx={{ width: "200px", height: "200px" }} />
<Typography display="inline" variant="h4" sx={{ textAlign: 'justify' }}>
<FormattedMessage id="verifyInfo"/>
</Typography>
<Button variant="outlined" component={Link} to="/login" color="primary">
<Typography variant="h5">
<FormattedMessage id="backToLogin"/>
</Typography>
</Button>
</Stack>
:
// ERROR page
// ERROR page (network / server error)
<Stack mt={1} direction="column" justifyContent="flex-start" alignItems="center" spacing={2}>
{/* <Button disabled={true} hidden={true} variant="contained" type="submit" sx={{ fontSize: 12,height:'25px'}}>Submit</Button> */}
<CancelOutlinedIcon color="error" sx={{ width: "200px", height: "200px" }} />
<Typography display="inline" variant="h4" sx={{textAlign: 'justify'}}>
<FormattedMessage id="verifyFail"/>