Skip to content

Commit

Permalink
don't lose comment if it failed to create
Browse files Browse the repository at this point in the history
  • Loading branch information
Zimmi48 committed Dec 19, 2014
1 parent 8918c4a commit bba91b3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion isso/js/app/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ define(["app/lib/promise", "app/globals"], function(Q, globals) {
var create = function(tid, data) {
var deferred = Q.defer();
curl("POST", endpoint + "/new?" + qs({uri: tid || location}), JSON.stringify(data),
function (rv) { deferred.resolve(JSON.parse(rv.body)); });
function (rv) {
if (rv.status === 201) {
deferred.resolve(JSON.parse(rv.body));
} else {
deferred.reject(rv.body);
}
});
return deferred.promise;
};

Expand Down

0 comments on commit bba91b3

Please # to comment.