added confirmation data
This commit is contained in:
@@ -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) => {
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user