Hi,
I'm implementing the scheduler as a personal event reminder, I want to use it in a Angular Application working offline some time, I wondered using Angular services, and observables in order to retrieve events, and making the CRUD, because I can control the request and response in case of loss of internet connectivity and return the localStorage data if any.
Can you help me?
I'm trying to override a DataAdaptor, catching the processResponse method, but this method it's only called when the response was successful, how can I return a fixed response if the request fails?
I tried overriding beforeSend, and creating anonymous function in request.onerror, I catch the error, but I don't know how to return the event data to the control.
class CustomAdaptor extends WebApiAdaptor {
processResponse(data: DataResult, ds?: DataOptions, query?: Query, xhr?: XMLHttpRequest, request?: Ajax, changes?: CrudOptions): Object {
//debugger;
console.log("--ProcessResponse--");
console.log(data);
return super.processResponse(data, ds, query, xhr, request, changes);
}
beforeSend(dm: DataManager, request: XMLHttpRequest, settings: Ajax)
{
request.onerror = function () {
//debugger;
console.log("--Error Request--");
//Here i want to return event data to the Adaptor --> Scheduler event
let localData = [{Id:1, Subject: "Subject 1", StartTime: new Date(), EndTime: new Date()}]
}
console.log("--beforeSend--");
super.beforeSend(dm, request, settings);
}
}