(js) Resource.post: argument 'id' is optional
This commit is contained in:
parent
fc3c362515
commit
523532b153
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue