feat: add user confirmation functionality and dynamic table creation; enhance MainForm with user selection and next ID display

This commit is contained in:
2026-01-19 13:51:33 +01:00
parent 1208d731ca
commit 3c5ec1923f
5 changed files with 97 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ import dotenv from "dotenv";
const router = express.Router();
dotenv.config();
import { getUser, confirmData } from "./frontend.data.js";
import { getUser, confirmData, confirmUser } from "./frontend.data.js";
router.post("/frontend", async (req, res) => {
const result = await confirmData(req.body);
@@ -11,7 +11,6 @@ router.post("/frontend", async (req, res) => {
return res.status(500).json({ message: "Form Data Invalid" });
}
console.log(req.body);
const user = await getUser(req.body.code);
console.log(user);
res.sendStatus(204);
});
@@ -21,4 +20,16 @@ router.get("/users", async (req, res) => {
res.json(users);
});
router.get("/confirm-user", async (req, res) => {
const username = req.query.username;
if (!username) {
return res.status(400).json({ message: "Username is required" });
}
const user = await confirmUser(username);
if (!user) {
return res.status(404).json({ message: "User not found" });
}
res.json(user);
});
export default router;