23rd Commit

This commit is contained in:
Aritra Banik
2024-02-08 22:35:58 +05:30
parent ee0d6ba78d
commit c4354da63e
5 changed files with 46 additions and 24 deletions

View File

@@ -181,6 +181,11 @@ import
email: string
password: string
db = newDatabase()
productName= ""
quantity = 0
cart: seq[Cart]
products: seq[Products]
price = 0.0
try:
email = ctx.cookies["email"]
@@ -190,19 +195,28 @@ import
password = ""
if email == "":
ctx.redirect("/login")
try:
productName = ctx.queryParams["prod"]
quantity = parseInt(ctx.queryParams["quantity"])
except:
productName = ""
quantity = 0
if productName == "":
ctx.redirect("/login")
price = db.getPriceByProductName(productName)
else:
var
userId = db.getUserId(email, password)
cart = db.getUserCart(userId)
products: seq[Products]
cart = db.getUserCart(userId)
for c, d in cart:
var product = db.getProductById(d.productId)
products.add(product)
compileTemplateFile(getScriptDir() / "a3a" / "checkout.nimja")
compileTemplateFile(getScriptDir() / "a3a" / "checkout.nimja")
"/contact" -> get: