Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions admin/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import Sidebar from "./components/Sidebar";
import BranchRepresentatives from "./pages/BranchRepresentatives";
import Students from "./pages/Students";
import Courses from "./pages/Courses";
import CourseLinking from "./pages/CourseLinking";
Expand All @@ -20,7 +19,7 @@ function App() {
path="/admin/"
element={
<PrivateRoute>
<BranchRepresentatives />
<Students />
</PrivateRoute>
}
/>
Expand Down
23 changes: 23 additions & 0 deletions admin/src/apis/br.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,26 @@ export const uploadBRs = async (file) => {
throw error;
}
};
// Delete BR
export const deleteBR = async(email) =>{
try {
const response = await
fetch(`${API_BASE_URL}api/br/delete`,{
method: "DELETE",
credentials: "include",
headers:{
"Content-Type":"application/json",
Authorization:"Bearer admin-coursehub-cc23-golang"},
body: JSON.stringify({email:email}),
});
const result = await response.json();
if(!response.ok){
throw new Error(result.error || result.message || "Failed to delete BR");
}
return result ;
}
catch (error){
console.error("Error deleting single BR:" , error);
throw error;
}
};
1 change: 0 additions & 1 deletion admin/src/components/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { FaBook, FaUsers, FaLayerGroup, FaLink, FaUserGraduate } from "react-ico
import { adminLogout } from "@/apis/auth";

const navItems = [
{ label: "Branch Representatives", to: "/admin/", icon: FaUsers },
{ label: "Students", to: "/admin/students", icon: FaUserGraduate },
{ label: "Courses", to: "/admin/courses", icon: FaBook },
{ label: "Course Linking", to: "/admin/course-linking", icon: FaLink },
Expand Down
115 changes: 0 additions & 115 deletions admin/src/components/UploadBRs.jsx

This file was deleted.

12 changes: 11 additions & 1 deletion admin/src/components/brTable.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";

const BrTable = ({ brs }) => {
const BrTable = ({ brs , onDelete }) => {
return (
<div className="p-6 bg-white rounded-lg shadow-md">
<div className="flex items-center mb-6">
Expand All @@ -25,6 +25,9 @@ const BrTable = ({ brs }) => {
<th className="py-3 px-4 text-left text-sm font-semibold text-gray-700">
Semester
</th>
<th className="py-3 px-4 text-left text-sm font-semibold text-gray-700">
Actions
</th>
</tr>
</thead>
<tbody className="divide-y divide-gray-100">
Expand All @@ -41,6 +44,13 @@ const BrTable = ({ brs }) => {
<td className="py-4 px-4 text-sm text-gray-600">
{person.semester}
</td>
<td className="py-4 px-4 text-sm text-gray-600">
<button onClick={() => onDelete(person.email)}
className="text-red-500 hover:text-red-900 font-medium transition" >
Remove
</button>
</td>

</tr>
))}
</tbody>
Expand Down
140 changes: 0 additions & 140 deletions admin/src/pages/BranchRepresentatives.jsx

This file was deleted.

Loading