Skip to content

Commit

Permalink
Fixes upes-open#56
Browse files Browse the repository at this point in the history
  • Loading branch information
ParthDhavan04 committed Jul 14, 2024
1 parent db933cc commit 31a6476
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bizsync-application/src/_dashboard/DashboardLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,25 @@ const dashboardItems = [
{ name: "Reports", path: "reports" },
];


const DashboardLayout = () => {
const [activeItem, setActiveItem] = useState("Home");
const [isSidebarOpen, setIsSidebarOpen] = useState(false);

useEffect(() => {
const fetchDashboardItems = async () => {
try {
const response = await fetch('http://localhost:8000/api/dashboard-items');
const data = await response.json();
setDashboardItems(data);
} catch (error) {
console.error("Error fetching dashboard items:", error);
}
};

fetchDashboardItems();
}, []);

const toggleSidebar = () => setIsSidebarOpen(!isSidebarOpen);

return (
Expand Down
1 change: 1 addition & 0 deletions server/dashboard_service/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ app.use("/api/v1", staffRoute);
app.use("/api/v1", reportRoute);
app.use("/api/v1", orderRoute);
app.use("/api/v1", inventoryRoute);
app.use("/api/v1", dashboardItems);

export { app };
21 changes: 21 additions & 0 deletions server/dashboard_service/src/routes/dashboard.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
app.use(express.json());
app.use(cors());

// Dashboard items
const dashboardItems = [
{ name: "Home", path: "home" },
{ name: "Receivables", path: "receivables" },
{ name: "Spends", path: "spends" },
{ name: "Inventory", path: "inventory" },
{ name: "Notification", path: "notification" },
{ name: "Supplier", path: "supplier" },
{ name: "Staff", path: "staff" },
{ name: "Financial", path: "financial" },
{ name: "Sales", path: "sales" },
{ name: "Reports", path: "reports" },
];

// Get all dashboard items
app.get('/api/dashboard-items', (req, res) => {
res.json(dashboardItems);
});
6 changes: 6 additions & 0 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 31a6476

Please sign in to comment.