mirror of
https://gitlab.com/nekoya/web.git
synced 2024-11-22 06:20:19 +01:00
Fix product page bug
This commit is contained in:
parent
5bf2242147
commit
a49ada9557
1 changed files with 15 additions and 23 deletions
|
@ -194,31 +194,23 @@ router.get("/products", (req, res) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get(["/product", "/product/:id"], (req, res) => {
|
router.get(["/product", "/product/:id"], (req, res) => {
|
||||||
if (!req.params.id) {
|
auth.session_converter(req.cookies.session_token).then((key) => {
|
||||||
auth.session_converter(req.cookies.session_token).then((key) => {
|
if (key != null) {
|
||||||
if (key != null) {
|
controller.getProduct(req.params.id).then((data) => {
|
||||||
controller.getProduct(req.params.id).then((data) => {
|
res.render("pages/product", {
|
||||||
if (data != undefined) {
|
data: data,
|
||||||
res.render("pages/product", {
|
loggedIn: 'true'
|
||||||
data: data,
|
|
||||||
loggedIn: 'true'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
res.redirect("/products");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
});
|
||||||
controller.getProduct(req.params.id).then((data) => {
|
} else {
|
||||||
res.render("pages/product", {
|
controller.getProduct(req.params.id).then((data) => {
|
||||||
data: data,
|
res.render("pages/product", {
|
||||||
loggedIn: 'false'
|
data: data,
|
||||||
});
|
loggedIn: 'false'
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
} else {
|
});
|
||||||
res.redirect("/products")
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get("/bag", (req, res) => {
|
router.get("/bag", (req, res) => {
|
||||||
|
|
Loading…
Reference in a new issue