diff --git a/src/App.tsx b/src/App.tsx
index 15f25b2..6db1229 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -9,6 +9,7 @@ import "react-toastify/dist/ReactToastify.css";
import ErrorPage from "./Pages/ErrorPage/ErrorPage";
import DashboardPage from "./Pages/DashboardPage/DashboardPage";
import Revalidator from "./Components/Revalidator/Revalidator";
+import ActivationPage from "./Pages/ActivationPage/ActivationPage";
const queryClient = new QueryClient();
const router = createHashRouter([
@@ -32,6 +33,15 @@ const router = createHashRouter([
),
errorElement: ,
},
+ {
+ path: "/activation/:uid/:token",
+ element: (
+ <>
+
+ >
+ ),
+ errorElement: ,
+ },
]);
export default function App() {
diff --git a/src/Components/API/API.tsx b/src/Components/API/API.tsx
index d00ab31..2b22ca5 100644
--- a/src/Components/API/API.tsx
+++ b/src/Components/API/API.tsx
@@ -121,7 +121,7 @@ export async function UserAPI() {
export function ActivationAPI(activation: ActivationType) {
return instance
.post("api/v1/accounts/users/activation/", activation)
- .then(async () => {
+ .then(() => {
console.log("Activation Success");
return true;
})
diff --git a/src/Components/Sidebar/Sidebar.tsx b/src/Components/Drawer/Drawer.tsx
similarity index 98%
rename from src/Components/Sidebar/Sidebar.tsx
rename to src/Components/Drawer/Drawer.tsx
index ab8ad0d..1360ac5 100644
--- a/src/Components/Sidebar/Sidebar.tsx
+++ b/src/Components/Drawer/Drawer.tsx
@@ -9,7 +9,7 @@ import { useDispatch } from "react-redux";
import { auth_toggle } from "../Plugins/Redux/Slices/AuthSlice/AuthSlice";
import { toast } from "react-toastify";
import { useNavigate } from "react-router-dom";
-export default function Sidebar() {
+export default function Drawer() {
const user = useQuery({ queryKey: ["user"], queryFn: UserAPI });
const dispatch = useDispatch();
const navigate = useNavigate();
diff --git a/src/Components/Header/Header.tsx b/src/Components/Header/Header.tsx
index b36f9c4..d0189e4 100644
--- a/src/Components/Header/Header.tsx
+++ b/src/Components/Header/Header.tsx
@@ -1,7 +1,7 @@
import { useState } from "react";
import styles, { colors } from "../../styles";
import MenuIcon from "@mui/icons-material/Menu";
-import SidebarModal from "../Sidebar/Sidebar";
+import SidebarModal from "../Drawer/Drawer";
import { Drawer } from "@mui/material";
export interface props {
label: string;
diff --git a/src/Components/LoginModal/LoginModal.tsx b/src/Components/LoginModal/LoginModal.tsx
index 50a8507..6cc9459 100644
--- a/src/Components/LoginModal/LoginModal.tsx
+++ b/src/Components/LoginModal/LoginModal.tsx
@@ -29,7 +29,11 @@ export default function LoginModal() {
{
+ 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",
+ });
+ setTimeout(() => {
+ navigate("/dashboard");
+ });
+ } else {
+ setFeedback("Invalid activation link");
+ setError(true);
+ }
+ });
+ }
+ if (!uid || !token) {
+ setFeedback("Missing uid or token");
+ }
+ setLoading(false);
+ }, [uid, token, feedback, navigate]);
+ return (
+
+
+ {loading ? (
+
+ ) : (
+ <>>
+ )}
+ {error && !loading ? (
+
+ ) : (
+
+ )}
+
+
{feedback}
+
+
+ Activating your CITC Equipment Tracker Account
+
+
+
+ );
+}