|
| 1 | +import React, { useEffect, useState } from "react"; |
| 2 | +import styled from "styled-components"; |
| 3 | +import { ActionButton } from "../shared/Buttons"; |
| 4 | +import { BoldTypography } from "../shared/Typography"; |
| 5 | +import { useHistory } from "react-router-dom"; |
| 6 | +import { useParams } from "react-router-dom"; |
| 7 | +import axios from "axios"; |
| 8 | +const HomeBtn = styled(ActionButton)` |
| 9 | + width: 148px; |
| 10 | + height: 47px; |
| 11 | +`; |
| 12 | + |
| 13 | +const TextFieldWrapper = styled.div` |
| 14 | + display: flex; |
| 15 | + flex-direction: column; |
| 16 | + align-items: center; |
| 17 | + justify-content: center; |
| 18 | + gap: 10px; |
| 19 | + min-width: 450px; |
| 20 | + min-height: 300px; |
| 21 | + margin-top: 20px; |
| 22 | + padding: 10px; |
| 23 | +`; |
| 24 | + |
| 25 | +const TextBox = styled.div` |
| 26 | + display: flex; |
| 27 | + text-align: center; |
| 28 | + justify-content: center; |
| 29 | + align-items: center; |
| 30 | +`; |
| 31 | + |
| 32 | +const Authenticated = () => { |
| 33 | + const [verified] = useState(false); |
| 34 | + const history = useHistory(); |
| 35 | + const { token } = useParams(); |
| 36 | + useEffect(() => { |
| 37 | + const verify = async () => { |
| 38 | + const res = await axios.get(`/auth/verifyAccount/${token}`); |
| 39 | + console.log(res); |
| 40 | + }; |
| 41 | + verify(); |
| 42 | + }, [token]); |
| 43 | + return verified ? ( |
| 44 | + <div> |
| 45 | + <TextFieldWrapper> |
| 46 | + <TextBox> |
| 47 | + <BoldTypography sz={"24px"}>Welcome to Embark!</BoldTypography> |
| 48 | + </TextBox> |
| 49 | + <TextBox> |
| 50 | + <BoldTypography sz={"18px"}> |
| 51 | + Your email address has been verified. |
| 52 | + </BoldTypography> |
| 53 | + </TextBox> |
| 54 | + <HomeBtn onClick={() => history.push("/home")}>Home</HomeBtn> |
| 55 | + </TextFieldWrapper> |
| 56 | + </div> |
| 57 | + ) : ( |
| 58 | + <div> |
| 59 | + <TextFieldWrapper> |
| 60 | + <TextBox> |
| 61 | + <BoldTypography sz={"24px"}>Verifying...</BoldTypography> |
| 62 | + </TextBox> |
| 63 | + </TextFieldWrapper> |
| 64 | + </div> |
| 65 | + ); |
| 66 | +}; |
| 67 | + |
| 68 | +export default Authenticated; |
0 commit comments