diff --git a/src/Components/Api/Api.tsx b/src/Components/Api/Api.tsx index ee47f8c..b0ad2bf 100644 --- a/src/Components/Api/Api.tsx +++ b/src/Components/Api/Api.tsx @@ -65,3 +65,21 @@ export function UserInfo() { console.log(error); }); } + +export interface activation { + uid: string; + token: string; +} + +export function UserActivate(activation: activation) { + return axios + .post("http://localhost:8000/api/v1/accounts/users/activation/", activation) + .then(async (response) => { + console.log("Activation Success"); + return true; + }) + .catch((error) => { + console.log("Activation failed: " + error); + return false; + }); +} diff --git a/src/Routes/Activation/Activation.tsx b/src/Routes/Activation/Activation.tsx new file mode 100644 index 0000000..a749f25 --- /dev/null +++ b/src/Routes/Activation/Activation.tsx @@ -0,0 +1,35 @@ +import styles from "../../styles"; +import Header from "../../Components/Header/Header"; +import { useParams } from "react-router-dom"; +import { useState } from "react"; +import { UserActivate } from "../../Components/Api/Api"; + +export interface activation { + uid: string; + token: string; +} +export default function Activation() { + let { uid, token } = useParams(); + const [activationStatus, setStatus] = useState("Activating..."); + async function verify(activation: activation) { + let status = await UserActivate(activation); + if (status) { + setStatus("Success!"); + } else { + setStatus("Invalid Activation Link"); + } + } + if (uid && token) { + verify({ uid, token }); + } + return ( +
User ID: {uid}
+Activation Token: {token}
+{activationStatus}
+