Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
Handle empty response in frappe.call
Browse files Browse the repository at this point in the history
  • Loading branch information
netchampfaris committed Oct 5, 2018
1 parent 04308fa commit c20fd14
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Expand Up @@ -56,8 +56,11 @@ module.exports = {
if (this.app) {
// add to router if client-server
this.app.post(`/api/method/${method}`, this.asyncHandler(async function(request, response) {
const data = await handler(request.body);
response.json(data);
let data = await handler(request.body);
if (data === undefined) {
data = {}
}
return response.json(data);
}));
}
},
Expand Down

0 comments on commit c20fd14

Please sign in to comment.