Skip to content

Commit 5bc132b

Browse files
committed
Fix json output based on error existence
1 parent faba277 commit 5bc132b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/views/json.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ exports.execute = function (error, data, response, status = 200) {
77
}
88

99
response.status(status).json({
10-
success: error === undefined && error === null && !error,
10+
success: error === undefined || error === null || !error,
1111
data,
1212
error
1313
});
1414
};
1515

1616
module.exports = class JsonView {
1717
standard (data, res, statusCode) {
18-
return exports.execute(null, data, res, statusCode);
18+
return exports.execute(undefined, data, res, statusCode);
1919
}
2020

2121
error (error, response) {
22-
return exports.execute(error, null, response);
22+
return exports.execute(error, undefined, response);
2323
}
2424

2525
async promise (action, response, next, statusCode) {

0 commit comments

Comments
 (0)