-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
Hi,
I've noticed that update/delete list item doesn't work when using sp-rest-proxy (local development with data from SP server), because in methods updateItem and deleteItem you use URL returned from list metadata, not that one used in createContext method.
This is my patch that I use, Im simply building the URL with _this.baseUrl:
var updateUri = _this.baseUrl+"/items("+itemId+")";
List.prototype.updateItem = function (itemId, updates, digest) {
var _this = this;
return this._dao.auth.ensureRequestDigest(digest).then(function (digest) {
return _this.getItemById(itemId).then(function (item) {
//decorate the item with the 'type' metadata
updates = Object.assign({}, {
__metadata: {
type: item["__metadata"].type,
},
}, updates);
var updateUri = _this.baseUrl+"/items("+itemId+")";
var customOptions = {
headers: utils.headers.getUpdateHeaders(digest, item["__metadata"].etag),
};
return _this._dao.post(updateUri, updates, customOptions);
});
});
};
With this change, update/delete works perfectly in local proxed and server environment.
Reactions are currently unavailable