1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00
planka/server/api/responses/conflict.js

37 lines
575 B
JavaScript
Raw Normal View History

2019-08-31 04:07:25 +05:00
/**
* conflict.js
*
* A custom response.
*
* Example usage:
* ```
* return res.conflict();
* // -or-
* return res.conflict(optionalData);
* ```
*
* Or with actions2:
* ```
* exits: {
* somethingHappened: {
* responseType: 'conflict'
* }
* }
* ```
*
* ```
* throw 'somethingHappened';
* // -or-
* throw { somethingHappened: optionalData }
* ```
*/
module.exports = function conflict(message) {
const { res } = this;
return res.status(409).json({
code: 'E_CONFLICT',
message,
2019-08-31 04:07:25 +05:00
});
};