Skip to content

Commit

Permalink
fixing more bugs on add tenant section
Browse files Browse the repository at this point in the history
  • Loading branch information
Norseolee committed Dec 22, 2023
1 parent 5b11d8f commit 8359ab4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,14 @@ app.delete("/meralco/delete/:meralco_id", (req, res) => {

//create a record tenant
app.post("/tenant/add-tenant", (req, res) => {
pool.getConnection((err, connection) => {
if (err) {
console.error("Error getting connection from pool:", err);
pool.getConnection((getConnectionErr, connection) => {
if (getConnectionErr) {
console.error("Error getting connection from pool:", getConnectionErr);
return res.status(500).send("Internal Server Error");
}

console.log(`Connected as id ${connection.threadId}`);

const tenantId = req.params.tenant_id;

const tenantParams = {
name: req.body["name"],
building: req.body["building"],
Expand Down Expand Up @@ -276,6 +274,7 @@ app.put("/tenant/update-tenant/:tenant_id", (req, res) => {

connection.release();
res.send(`Tenant with ID ${tenantId} has been updated`);
res.redirect("/");
}
);
});
Expand Down

0 comments on commit 8359ab4

Please sign in to comment.