(js) Resource.post: argument 'id' is optional

This commit is contained in:
Francis Lachapelle 2015-05-01 09:54:49 -04:00
parent fc3c362515
commit 523532b153

View file

@ -130,7 +130,10 @@
*/ */
Resource.prototype.post = function(id, action, data) { Resource.prototype.post = function(id, action, data) {
var deferred = this._q.defer(), var deferred = this._q.defer(),
path = this._path + '/' + id + '/' + action; path = [this._path];
if (id) path.push(id);
if (action) path.push(action);
path = _.compact(_.flatten(path)).join('/');
this._http this._http
.post(path, data) .post(path, data)