feat: enhance user confirmation and data submission; add newEntry function and update MainForm to handle user selection
This commit is contained in:
@@ -3,15 +3,16 @@ import dotenv from "dotenv";
|
||||
const router = express.Router();
|
||||
dotenv.config();
|
||||
|
||||
import { getUser, confirmData, confirmUser } from "./frontend.data.js";
|
||||
import { getUser, newEntry, confirmUser } from "./frontend.data.js";
|
||||
|
||||
router.post("/frontend", async (req, res) => {
|
||||
const result = await confirmData(req.body);
|
||||
router.post("/new-entry", async (req, res) => {
|
||||
const username = req.query.username;
|
||||
const result = await newEntry(req.body, username);
|
||||
if (!result.success) {
|
||||
return res.status(500).json({ message: "Form Data Invalid" });
|
||||
}
|
||||
console.log(req.body);
|
||||
console.log(user);
|
||||
console.log(username);
|
||||
res.sendStatus(204);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user