added confirmation data

This commit is contained in:
2026-01-14 17:32:41 +01:00
parent 89f40ac854
commit 130167bfa2
2 changed files with 12 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ const pool = mysql
})
.promise();
export const getAll25 = async () => {
export const getUser = async () => {
const [rows] = await pool.query("SELECT unique_key FROM users");
if (rows.length > 0) {
return {rows};
@@ -19,3 +19,7 @@ export const getAll25 = async () => {
return { message: "No data found" };
}
};
export const confirmData = async (data) => {
}

View File

@@ -3,11 +3,16 @@ import dotenv from "dotenv";
const router = express.Router();
dotenv.config();
import { getAll25 } from "./frontend.data.js";
import { getUser, confirmData } from "./frontend.data.js";
router.post("/frontend", async (req, res) => {
const result = await confirmData(req.body);
if (!result.success) {
return res.status(500).json({ message: "Form Data Invalid" });
}
console.log(req.body);
// 204 = "No Content"; beendet die Response sauber ohne Body
const user = await getUser(req.body.code);
console.log(user);
res.sendStatus(204);
});