This commit is contained in:
Harikrishnan Gopal
2025-01-22 01:58:09 +05:30
parent 7079591f84
commit 1fc49ca69a
6 changed files with 109 additions and 62 deletions

View File

@@ -12,6 +12,7 @@ import FilterPage from "./Pages/FilterPage";
import WelcomeWithFilter from "./Pages/WelcomeWithFilter";
import "react-toastify/dist/ReactToastify.css";
import CourseTable from "./Pages/CourseTable";
import GenerateCSV from "./Pages/GenerateCSV";
function App() {
return (
@@ -19,6 +20,7 @@ function App() {
{/* <Navbar /> */}
<Routes>
<Route path="/" element={<AuthPage />}></Route>
<Route path="/generate-csv" element={<GenerateCSV />} />
<Route path="/course-form/:id" element={<CourseForm />} />
<Route path="/faculty-form/:id" element={<FacultyForm />} />
<Route path="/Welcom" element={<WelcomeWithFilter />} />

View File

@@ -0,0 +1,26 @@
import React from "react";
import axios from "axios";
const GenerateCSV = () => {
const handleGenerateCSV = async () => {
try {
const response = await axios.get("http://localhost:8080/api/csv/generate");
if (response.status === 200) {
alert("CSV generated successfully. Check the generated_csv folder in the server.");
}
} catch (error) {
console.error("Error generating CSV:", error);
alert("Failed to generate CSV");
}
};
return (
<div>
<button onClick={handleGenerateCSV} style={{ padding: "10px 20px", fontSize: "16px" }}>
Generate CSV
</button>
</div>
);
};
export default GenerateCSV;