This commit is contained in:
Moe Poi ~ 2021-11-22 00:33:56 +07:00
parent 8f716919a1
commit 7ba3ade385
2 changed files with 13 additions and 13 deletions

View file

@ -33,10 +33,10 @@ function session_converter(session) {
res(null);
}
}
db.disconnect(conn);
}
);
});
db.disconnect(conn);
return key;
}
@ -66,13 +66,13 @@ function session_remove(key, session_token) {
console.log('sukses');
res(true)
}
db.disconnect(conn);
}
);
}
}
);
});
db.disconnect(conn);
return status;
}
@ -92,10 +92,10 @@ function auth_checker(key) {
res(false);
}
}
db.disconnect(conn);
}
);
});
db.disconnect(conn);
return status;
}

View file

@ -22,8 +22,8 @@ router.get("/getproducts", (req, res) => {
const conn = db.connect();
conn.execute("SELECT * FROM `products`", [], function (err, results) {
res.json(results);
db.disconnect(conn);
});
db.disconnect(conn);
});
router.get("/getproduct", (req, res) => {
@ -33,9 +33,9 @@ router.get("/getproduct", (req, res) => {
[req.query.id],
function (err, results) {
res.json(results);
db.disconnect(conn);
}
);
db.disconnect(conn);
});
router.post("/register", async (req, res) => {
@ -128,6 +128,7 @@ router.post("/register", async (req, res) => {
message: "Register Verification Sent ~",
});
}
db.disconnect(conn);
}
);
} else {
@ -152,7 +153,6 @@ router.post("/register", async (req, res) => {
}
}
);
db.disconnect(conn);
}
});
@ -222,6 +222,7 @@ router.post("/login", async (req, res) => {
session_token: token,
});
}
db.disconnect(conn);
}
);
}
@ -241,7 +242,6 @@ router.post("/login", async (req, res) => {
}
}
);
db.disconnect(conn);
}
});
@ -277,6 +277,7 @@ router.post("/verify-mail", async (req, res) => {
message: "Verified ~",
});
}
db.disconnect(conn);
}
);
} else {
@ -293,7 +294,6 @@ router.post("/verify-mail", async (req, res) => {
}
}
);
db.disconnect(conn);
});
router.post("/request-reset-password", async (req, res) => {
@ -333,9 +333,9 @@ router.post("/request-reset-password", async (req, res) => {
});
}
}
db.disconnect(conn);
}
);
db.disconnect(conn);
}
});
@ -388,6 +388,7 @@ router.post("/reset-password", async (req, res) => {
message: "Success Reset Password ~",
});
}
db.disconnect(conn);
}
);
} else {
@ -398,7 +399,6 @@ router.post("/reset-password", async (req, res) => {
}
}
);
db.disconnect(conn);
}
} else {
res.status(401);
@ -494,6 +494,7 @@ router.post("/checkout", async (req, res) => {
'data': result[0].data
});
}
db.disconnect(conn);
});
}
}
@ -501,7 +502,6 @@ router.post("/checkout", async (req, res) => {
}
}
);
db.disconnect(conn);
}
} else {
res.status(401);
@ -546,12 +546,12 @@ router.post("/transaction", async (req, res) => {
res.status(200);
res.json(resp);
}
db.disconnect(conn);
}
);
}
}
);
db.disconnect(conn);
} else {
res.status(401);
res.json({
@ -594,6 +594,7 @@ router.get("/subscribe", (req, res) => {
message: "Success",
});
}
db.disconnect(conn);
}
);
} else {
@ -604,7 +605,6 @@ router.get("/subscribe", (req, res) => {
}
}
);
db.disconnect(conn);
}
});