diff --git a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js index ba98af2f10de8b0ab3c9908bc50f554ec5252adc..3fc174325d2fb243e1bcaf1bbfaae1e59386e2dd 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js @@ -8,22 +8,26 @@ axios.defaults.headers.common['Authorization'] = 'Basic dGVzdDp0ZXN0'; const ScheduleService = { getSchedulingUnitDraft: async function (){ let res = []; - await axios.get('/api/scheduling_unit_draft/?ordering=id') - .then(response => { - res= response; - }).catch(function(error) { + try { + res = await axios.get('/api/scheduling_unit_draft/?limit=1'); + if (res.data.count > res.data.results.length) { + res = await axios.get(`/api/scheduling_unit_draft/?ordering=id&limit=${res.data.count}&offset=0`); + } + } catch(error) { console.error('[schedule.services.getSchedulingUnitDraft]',error); - }); + } return res; }, getSchedulingUnitBlueprint: async function (){ let res = []; - await axios.get('/api/scheduling_unit_blueprint/?ordering=id') - .then(response => { - res= response; - }).catch(function(error) { + try { + res = await axios.get('/api/scheduling_unit_blueprint/?limit=1'); + if (res.data.count > res.data.results.length) { + res = await axios.get(`/api/scheduling_unit_blueprint/?ordering=id&limit=${res.data.count}&offset=0`); + } + } catch(error) { console.error('[schedule.services.getSchedulingUnitBlueprint]',error); - }); + } return res; }, getSchedulingUnitBlueprintById: async function (id){