The endpoints we rely on for our stores are always POST request regardless of what the endpoint is used for. So in our case our Resource read endpoint (/Objects/Tree) is, instead of a GET request, a POST request which expects some data to be posted otherwise the endpoint will result in an error.
For reading resources I could simply 'patch' this by giving the store an empty object as body within the fetch options:
const resourceStore = new bryntum.scheduler.ResourceStore({
readUrl: 'https://preview.wem.io/41834/webservices/Objects/Tree',
autoLoad : true,
useRestfulMethods : true,
httpMethods : {
create : 'POST',
read : 'POST',
update : 'PATCH',
delete : 'DELETE'
},
headers : {
'Content-Type': 'application/json'
},
// Body property with empty object stringified ensures the endpoint above doesn't result in error
fetchOptions: {
body: JSON.stringify({}),
credentials: 'omit',
redirect: 'error'
}
});
Unfortunatly using this approach will break the create, update and delete calls of the stores because using the fetchOptions.body property will overwrite the data posted by default.
Is there a way that we would only post an empty object in the case of the read calls of the stores and in all other cases post the data which is being sent by default?