import { useNavigate, useParams } from "react-router-dom"; import styles, { colors } from "../../styles"; import { ActivationAPI } from "../../Components/API/API"; import { useEffect, useState } from "react"; import { CircularProgress } from "@mui/material"; import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutline"; import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline"; import { toast } from "react-toastify"; export default function ActivationPage() { const { uid, token } = useParams(); const [feedback, setFeedback] = useState(""); const [error, setError] = useState(false); const [loading, setLoading] = useState(true); const navigate = useNavigate(); useEffect(() => { if (uid && token && feedback == "") { ActivationAPI({ uid, token }).then((response) => { if (response) { setFeedback("Activation successful"); toast("Activation successful", { position: "top-right", autoClose: 2000, hideProgressBar: false, closeOnClick: true, pauseOnHover: true, draggable: true, progress: undefined, theme: "light", }); toast("Please login to continue", { position: "top-right", autoClose: 6000, hideProgressBar: false, closeOnClick: true, pauseOnHover: true, draggable: true, progress: undefined, theme: "light", }); setTimeout(() => { navigate("/"); }); } else { setFeedback("Invalid activation link"); setError(true); } }); } if (!uid || !token) { setFeedback("Missing uid or token"); } setLoading(false); }, [uid, token, feedback, navigate]); return (
{feedback}
Activating your CITC Equipment Tracker Account