Hello
I would like to send a message “please wait we are working on your request” before to call my api.
But this message appear when I’ send a message with the results of api.
In my web plugin, I used delegate component. Bellow you can see my code
onStartPmChecklist() {
return this.$delegate(StartDateListOfPmCheckListComponent, {
resolve: {
successStartDate: this.onEndPmChecklist,
},
});
}
onEndPmChecklist(startDate: string) {
this.$component.data.startDate = startDate;
return this.$delegate(EndDateListOfPmCheckListComponent, {
resolve: {
successEndDate: this.onListPmChecklist,
},
});
}
onListPmChecklist(endDate: string) {
this.$data.serialNumber = this.$component.data.serialNumber;
this.$data.endDate = endDate;
this.$data.startDate = this.$component.data.startDate;
return this.$delegate(ListOfPmCheckListComponent, {
resolve: {
needAnotherHelp: this.onNeedAnotherHelp,
notNeedAnotherHelp: this.onNotNeedAnotherHelp,
},
});
}
const TPL_TICKET = 'pm_checkList';
@Component()
export class ListOfPmCheckListComponent extends BaseComponent {
async START() {
const system_id = this.$data.serialNumber;
const f_api_endDate = this.$data.endDate;
const f_api_startDate = this.$data.startDate;
console.log(
`system_id : ${system_id}, f_api_startDate : ${f_api_startDate}, f_api_endDate :${f_api_endDate}`,
);
this.$send('please wait');
const data: PmCheckListCRM[] = await checkListApi(system_id, f_api_startDate, f_api_endDate);
if (data.length == 0) {
this.$send({ message: this.$t('emptyPMCheckList') });
} else {
this.$send([
{
message: this.$t('belowPreventive'),
},
]);
const arrPdfFile: PDFFile[] = [];
const arrInfoPM: InfoPM[] = [];
for (const index in data) {
const obj = new PDFFile(
`PMCheckList_${data[index].caseNumber}.pdf`,
data[index].checkListInfo.pdfEncrypt,
);
const info = new InfoPM(data[index].caseNumber, data[index].endDate);
arrPdfFile.push(obj!);
arrInfoPM.push(info);
this.$send({
message: this.$t('detailPM', {
case_number: data[index].caseNumber,
close_date: data[index].endDate,
ownername: data[index].ownername,
}),
});
}
}
return this.$send(YesNoOutput, { message: this.$t('needAnotherHelpService') });
}
@Intents(['YesIntent'])
needAnotherHelp() {
return this.$resolve('needAnotherHelp');
}
@Intents(['NoIntent'])
notNeedAnotherHelp() {
return this.$resolve('notNeedAnotherHelp');
}
UNHANDLED() {
this.$send({ message: this.$t('responseNotValid') });
return this.START();
}
}
Can you help me, please ?
Romain