Skip to content

Commit

Permalink
Fixes bug where using a model only (with no collection) and the api r…
Browse files Browse the repository at this point in the history
…eturns an object say, rather than an array.
  • Loading branch information
icecandy committed Aug 20, 2018
1 parent d3eacf9 commit 3d4b2a3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions reste.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,15 @@ var main = function() {

if (modelConfig.content) {

var results = e[modelConfig.content];
var result = e[modelConfig.content];

if (results.length === 1) {
options.success(results[0]);
if (result.length === 1) {
//result is an array with value as first entry
options.success(result[0]);
}
else {
//result is not an array
options.success(result);
}
} else {
// calls error handler if we have it defined and 201+ returned
Expand Down

0 comments on commit 3d4b2a3

Please sign in to comment.