{loading ? (
diff --git a/client/src/Pages/AdminCoursePage.jsx b/client/src/Pages/AdminCoursePage.jsx
index 4791328..e321979 100644
--- a/client/src/Pages/AdminCoursePage.jsx
+++ b/client/src/Pages/AdminCoursePage.jsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import Navbar from './Navbar';
-import { toast, ToastContainer } from "react-toastify";
+import { toast} from "react-toastify";
import 'react-toastify/dist/ReactToastify.css';
import { useNavigate } from 'react-router-dom';
import Footer from './Footer';
@@ -149,7 +149,6 @@ export const AdminCoursePage = () => {
return (
<>
-
Course Management
diff --git a/client/src/Pages/AdminFacultyPage.jsx b/client/src/Pages/AdminFacultyPage.jsx
index c80225a..667a5e3 100644
--- a/client/src/Pages/AdminFacultyPage.jsx
+++ b/client/src/Pages/AdminFacultyPage.jsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import Navbar from './Navbar';
-import { toast, ToastContainer } from "react-toastify";
+import { toast } from "react-toastify";
import 'react-toastify/dist/ReactToastify.css';
import { useNavigate } from 'react-router-dom';
import Footer from './Footer';
@@ -28,18 +28,18 @@ export const AdminFacultyPage = () => {
useEffect(() => {
const checkAdmin = async () => {
try {
- const res = await axios.get("http://localhost:8080/api/me", { withCredentials: true });
- console.log(res.data);
- if (!res.data.isAdmin) {
- handleUnauthorizedAccess();
- } else {
- setIsLoading(false);
- }
- } catch (error) {
- console.error("Unauthorized access:", error);
+ const res = await axios.get("http://localhost:8080/api/me", { withCredentials: true });
+ console.log(res.data);
+ if (!res.data.isAdmin) {
handleUnauthorizedAccess();
+ } else {
+ setIsLoading(false);
+ }
+ } catch (error) {
+ console.error("Unauthorized access:", error);
+ handleUnauthorizedAccess();
}
- };
+ };
fetchFaculties();
fetchCourses();
checkAdmin();
@@ -47,19 +47,19 @@ export const AdminFacultyPage = () => {
const handleUnauthorizedAccess = async () => {
try {
- toast.warning("Unauthorized access. Logging out...", { position: "top-center" });
+ toast.warning("Unauthorized access. Logging out...", { position: "top-center" });
- // Attempt to log out
- await axios.get("http://localhost:8080/auth/logout", { withCredentials: true });
+ // Attempt to log out
+ await axios.get("http://localhost:8080/auth/logout", { withCredentials: true });
- // Delay redirection to show the toast message
- setTimeout(() => {
- navigate("/"); // Redirect to login
- }, 1500);
+ // Delay redirection to show the toast message
+ setTimeout(() => {
+ navigate("/"); // Redirect to login
+ }, 1500);
} catch (error) {
- console.error("Error during unauthorized access handling:", error);
+ console.error("Error during unauthorized access handling:", error);
}
-};
+ };
useEffect(() => {
if (!isLoading) {
@@ -207,102 +207,102 @@ export const AdminFacultyPage = () => {
{showForm && (
-
-
-
{isEditMode ? 'Edit Faculty' : 'Add New Faculty'}
-
-