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
4 changes: 4 additions & 0 deletions hab-frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import MessChangePage from "./pages/MessChangePage.jsx";
import GalaDinnerPage from "./pages/GalaDinnerPage.jsx";
import GalaDinnerDetailPage from "./pages/GalaDinnerDetailPage.jsx";
import Notifications from "./pages/Notifications.jsx";
import MessClosurePage from "./pages/MessClosurePage.jsx";
import CreateMess from "./components/CreateMess";
import MessDetails from "./components/MessDetails";
import MessMenu from "./components/MessMenu";
Expand Down Expand Up @@ -94,6 +95,9 @@ function App() {
path="/notifications"
element={<Notifications />}
/>
<Route path="/mess-closures"
element={<MessClosurePage />}
/>
</Routes>
</div>
</div>
Expand Down
26 changes: 26 additions & 0 deletions hab-frontend/src/apis/messClosures.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import axios from "axios";
import { BACKEND_URL } from "./server";

export const getAllMessClosures = async (filters = {}) => {
const params = new URLSearchParams(
Object.fromEntries(Object.entries(filters).filter(([, v]) => v !== "" && v !== undefined))
).toString();
const url = `${BACKEND_URL}/hostel/closure${params ? `?${params}` : ""}`;
const response = await axios.get(url);
return response.data;
};

export const createMessClosure = async (data) => {
const response = await axios.post(`${BACKEND_URL}/hostel/closure`, data);
return response.data;
};

export const updateMessClosure = async (id, data) => {
const response = await axios.put(`${BACKEND_URL}/hostel/closure/${id}`, data);
return response.data;
};

export const deleteMessClosure = async (id) => {
const response = await axios.delete(`${BACKEND_URL}/hostel/closure/${id}`);
return response.data;
};
3 changes: 3 additions & 0 deletions hab-frontend/src/components/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
SettingOutlined,
BookOutlined,
NotificationOutlined,
CalendarOutlined,
GiftOutlined,
} from "@ant-design/icons";

Expand Down Expand Up @@ -40,6 +41,8 @@ const Sidebar = ({ collapsed = false, onToggle }) => {
path: "/notifications",
icon: <NotificationOutlined />,
},
{ key: "8", name: "Mess Closures", path: "/mess-closures",
icon: <CalendarOutlined /> },
];

return (
Expand Down
Loading