enhance dashboard and user interface: update heading sizes, translate user label to German, and implement loan management features including fetching and displaying loans with error handling

This commit is contained in:
2025-09-02 18:51:41 +02:00
parent 769d1117eb
commit b217769961
8 changed files with 262 additions and 32 deletions

View File

@@ -14,6 +14,7 @@ import {
deleteUserID,
handleEdit,
createUser,
getAllLoans,
} from "../services/database.js";
import { authenticate, generateToken } from "../services/tokenService.js";
const router = express.Router();
@@ -238,4 +239,12 @@ router.post("/createUser", authenticate, async (req, res) => {
return res.status(500).json({ message: "Failed to create user" });
});
router.get("/allLoans", authenticate, async (req, res) => {
const result = await getAllLoans();
if (result.success) {
return res.status(200).json(result.data);
}
return res.status(500).json({ message: "Failed to fetch loans" });
});
export default router;