Team,
I am using crudmanager and after first load request, I want to send an id as a parameter to sync request of crudmanager that comes as a response from the crudmanagers load request.
But I can see load and sync getting fired simultaneously.
Do you see anything incorrct here?
this.crudManager = {
listeners: {
load({ response }) {
console.log(response);
const
start = new Date(response.calendar.startDate);
const end = new Date(response.calendar.endDate);
var childId = (response.details.childId);
var parentId = response.details.parentId;
console.log(childId);
console.log(parentId);
this.scheduler.setTimeSpan(start, end); // set calendar startdate and enddate
},
beforeResponseApply: ({ response }) => {
response.resources.rows = response.resources.vehicles;
response.events.rows = response.events.tests;
response.timeRanges.rows = response.timeRanges.dueDates;
localStorage.setItem('CurrentSelectedScheduleChildId', response.details.childId);
console.log(localStorage.getItem('CurrentSelectedScheduleChildId'));
},
//beforeSend: ({ params }) => {
// // can be used to dynamically add arbitrary parameters to data load/sync requests
// const queryString = JSON.parse(
// localStorage.getItem('CurrentSelectedScheduleChildId')
// );
// params.outputScheduleId = queryString;
// console.log(params.outputScheduleId);
// // params.config = queryString;
//}
},
autoLoad: true,
autoSync: true,
transport: {
load: {
url: 'https://localhost:5000/api/Schedule',
params: {
outputScheduleId: JSON.parse(
localStorage.getItem('CurrentSelectedSchedule')
),
}
method: 'GET',
credentials: 'omit',
},
sync: {
url: 'https://localhost:5000/api/ReScheduling',
params: {
outputScheduleChildId: JSON.parse(
localStorage.getItem('CurrentSelectedScheduleChildId')
)
},
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
credentials: 'omit'
}
}
};