Fix product page bug

This commit is contained in:
Moe Poi ~ 2021-11-21 09:27:02 +07:00
parent 5bf2242147
commit a49ada9557

View file

@ -194,18 +194,13 @@ router.get("/products", (req, res) => {
});
router.get(["/product", "/product/:id"], (req, res) => {
if (!req.params.id) {
auth.session_converter(req.cookies.session_token).then((key) => {
if (key != null) {
controller.getProduct(req.params.id).then((data) => {
if (data != undefined) {
res.render("pages/product", {
data: data,
loggedIn: 'true'
});
} else {
res.redirect("/products");
}
});
} else {
controller.getProduct(req.params.id).then((data) => {
@ -216,9 +211,6 @@ router.get(["/product", "/product/:id"], (req, res) => {
});
}
});
} else {
res.redirect("/products")
}
});
router.get("/bag", (req, res) => {