Closed sc-starman closed 5 years ago
So your first attempt should be right:
odata.o('http://localhost:5055/odata/').patch('userNotifications(1)', {state:'1'}).patch('userNotifications(1)', {state:'1'}).batch()
That should work, and the error seems to be a status from your odata server. Can you check what is send in the details of the error message?
btw.: patching two times the same resource might also be not the best idea :thinking:
Unfortunately, as I posted before the error was not clear at all: However, If I send a single request It would work as it should. --I did also test with two different resources but it doesn't change anything.
sorry, I cannot help that much here. Can you post the plain Request/Respons?
The test for batching against the odata example implementation works for that case. I am really unable to reproduce such issues, as I cannot verify if it is a backend or frontend issue. If you provide me with an endpoint where you can reproduce it, I might be able to help. But atm I can just suggest debugging your backend to see if there is any more meaningfull error shown.
I have tried batch() a couple of patch request but it produces a nonsense error like this:
I use this syntax to make a request:
odata.o('http://localhost:5055/odata/').patch('userNotifications(1)', {state:'1'}).patch('userNotifications(1)', {state:'1'}).batch()
I have also tried this syntax that suggested in with no luck:
odata.o('http://localhost:5055/odata/usernotifications/2').patch(data).batch('http://localhost:5055/odata/usernotifications/2').patch(data).save(function () { console.log('luck!') });
Error:o(...).patch(...).batch(...).patch is not a function
However I don't have any problem for a get request using the first one as:
odata.o('http://localhost:5055/odata/').get('userNotifications').get('userNotifications').batch()