forked from CSI-KJSCE/appointment_to_examiner
csv code
This commit is contained in:
@@ -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 />} />
|
||||
|
||||
26
client/src/Pages/GenerateCSV.jsx
Normal file
26
client/src/Pages/GenerateCSV.jsx
Normal 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;
|
||||
Reference in New Issue
Block a user