mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 05:09:43 +02:00
37 lines
580 B
JavaScript
37 lines
580 B
JavaScript
|
/**
|
||
|
* forbidden.js
|
||
|
*
|
||
|
* A custom response.
|
||
|
*
|
||
|
* Example usage:
|
||
|
* ```
|
||
|
* return res.forbidden();
|
||
|
* // -or-
|
||
|
* return res.forbidden(optionalData);
|
||
|
* ```
|
||
|
*
|
||
|
* Or with actions2:
|
||
|
* ```
|
||
|
* exits: {
|
||
|
* somethingHappened: {
|
||
|
* responseType: 'forbidden'
|
||
|
* }
|
||
|
* }
|
||
|
* ```
|
||
|
*
|
||
|
* ```
|
||
|
* throw 'somethingHappened';
|
||
|
* // -or-
|
||
|
* throw { somethingHappened: optionalData }
|
||
|
* ```
|
||
|
*/
|
||
|
|
||
|
module.exports = function forbidden(message) {
|
||
|
const { res } = this;
|
||
|
|
||
|
return res.status(403).json({
|
||
|
code: 'E_FORBIDDEN',
|
||
|
message
|
||
|
});
|
||
|
};
|