Skip to content

Commit

Permalink
Millorada la definició d’errors d’estat HTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
albertms10 committed May 31, 2020
1 parent e79c6fa commit 8c6738b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions server/controllers/assajos.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ exports.assajos_post = async (req, res, next) => {
)
.then(() => {
connection.commit();
res.send();
res.status(204).send();
})
.catch(transactionRollback);
})
Expand Down Expand Up @@ -138,6 +138,6 @@ exports.assajos_delete = async (req, res, next) => {
COMMIT;`,
[id_assaig]
)
.then(() => res.send())
.then(() => res.status(204).send())
.catch((e) => next(e));
};
2 changes: 1 addition & 1 deletion server/controllers/esdeveniments.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ exports.esdeveniments_post = (req, res, next) => {
VALUES (?, ?, ?, ?, ?);`,
[data_inici, data_final, estat_esdeveniment]
)
.then((result) => res.end(result))
.then(() => res.status(204).send())
.catch((e) => next(e));
};

Expand Down
2 changes: 1 addition & 1 deletion server/controllers/localitzacions.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports.localitzacions_post = (req, res, next) => {
VALUES (?, ?, ?, ?, ?, ?, ?)`,
[tipus_via, carrer, numero, fins_numero, codi_postal, gmaps, ciutat]
)
.then((result) => res.send(result))
.then(() => res.status(204).send())
.catch((e) => next(e));
};

Expand Down
7 changes: 4 additions & 3 deletions server/controllers/socis.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ exports.socis_post = async (req, res, next) => {
)
.then(() => {
connection.commit();
res.send();
res.status(204).send();
})
.catch(transactionRollback);
})
Expand Down Expand Up @@ -273,7 +273,7 @@ exports.socis_delete = (req, res, next) => {
COMMIT;`,
[id_persona]
)
.then(() => res.send())
.then(() => res.status(204).send())
.catch((e) => next(e));
};

Expand Down Expand Up @@ -410,7 +410,8 @@ exports.socis_detall_acceptadretsimatge_put = (req, res, next) => {
exports.socis_detall_acceptacions_put = (req, res, next) => {
const pool = req.app.get("pool");
const id_soci = req.params.id;
const acceptacions = req.body; // { form_name: true }
/** @type {Object<string, boolean>} */
const acceptacions = req.body;

pool
.query(
Expand Down

0 comments on commit 8c6738b

Please sign in to comment.