diff --git a/client/src/components/AdministratorNavigationPanel.tsx b/client/src/components/AdministratorNavigationPanel.tsx
index 5fefd33..991b9e2 100644
--- a/client/src/components/AdministratorNavigationPanel.tsx
+++ b/client/src/components/AdministratorNavigationPanel.tsx
@@ -3,6 +3,10 @@ import {
Button,
Card,
CircularProgress,
+ Dropdown,
+ DropdownItem,
+ DropdownMenu,
+ DropdownTrigger,
ScrollShadow,
} from "@nextui-org/react";
import {
@@ -14,6 +18,7 @@ import {
GiftTopIcon,
ChatBubbleOvalLeftIcon,
ChevronLeftIcon,
+ ArrowRightStartOnRectangleIcon,
} from "../icons";
import EcoconnectFullLogo from "./EcoconnectFullLogo";
import { retrieveUserInformation } from "../security/users";
@@ -176,26 +181,42 @@ export default function AdministratorNavigationPanel() {
-
)}
diff --git a/client/src/components/SignInModule.tsx b/client/src/components/SignInModule.tsx
index 763d136..9437c40 100644
--- a/client/src/components/SignInModule.tsx
+++ b/client/src/components/SignInModule.tsx
@@ -7,6 +7,7 @@ import NextUIFormikInput from "./NextUIFormikInput";
import { useNavigate } from "react-router-dom";
import { ChevronLeftIcon } from "../icons";
import { popErrorToast } from "../utilities";
+import { retrieveUserInformation } from "../security/users";
const validationSchema = Yup.object({
email: Yup.string()
@@ -39,7 +40,13 @@ export default function SignInModule() {
.post(config.serverAddress + "/users/login", values)
.then((response) => {
localStorage.setItem("accessToken", response.data.accessToken);
- navigate("/springboard/");
+ retrieveUserInformation().then((value) => {
+ if (value.accountType == 2) {
+ navigate("/admin");
+ } else {
+ navigate("/springboard/");
+ }
+ });
})
.catch((error) => {
popErrorToast(error);
diff --git a/client/src/pages/AdministratorSpringboard.tsx b/client/src/pages/AdministratorSpringboard.tsx
index 3f32a53..8374b7a 100644
--- a/client/src/pages/AdministratorSpringboard.tsx
+++ b/client/src/pages/AdministratorSpringboard.tsx
@@ -29,9 +29,12 @@ export default function AdministratorSpringboard() {
useEffect(() => {
retrieveUserInformation()
.then((response) => {
+ if (response.accountType != 2) {
+ navigate("/");
+ }
setUserInformation(response);
})
- .catch((_) => {
+ .catch(() => {
navigate("/signin");
});
return;