mirror of
https://gitlab.com/nekoya/web.git
synced 2024-11-14 02:16:19 +01:00
Fix checkout API
This commit is contained in:
parent
efd61589ea
commit
a9d1f8e9ee
1 changed files with 51 additions and 38 deletions
|
@ -327,6 +327,16 @@ router.post("/checkout", async (req, res) => {
|
|||
});
|
||||
} else {
|
||||
const conn = db.connect();
|
||||
conn.query(
|
||||
"SELECT * FROM users WHERE token = ?",
|
||||
[req.query.key],
|
||||
async function (error, resp, fields) {
|
||||
if (error) {
|
||||
res.status(401);
|
||||
res.json({
|
||||
message: "Unauthorized",
|
||||
});
|
||||
} else {
|
||||
var data = {
|
||||
firstName: req.body.firstName,
|
||||
lastName: req.body.lastName,
|
||||
|
@ -342,7 +352,7 @@ router.post("/checkout", async (req, res) => {
|
|||
logistic: req.body.logistic,
|
||||
paymentMethod: '-',
|
||||
data: req.body.data,
|
||||
userId: 14,
|
||||
userId: resp[0].id,
|
||||
paid: '0',
|
||||
status: 'pending'
|
||||
};
|
||||
|
@ -376,6 +386,9 @@ router.post("/checkout", async (req, res) => {
|
|||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
res.status(401);
|
||||
res.json({
|
||||
|
|
Loading…
Reference in a new issue