| | |
| | | this.clearAppointmentIdFromMsg(); |
| | | } |
| | | |
| | | private readAppointment(): void { |
| | | appointmentService.recordRead(this.client.id).then((_) => { |
| | | const updatedClient = {...this.client}; |
| | | updatedClient.consultantReadTime = new Date().toString(); |
| | | this.updateMyAppointmentList(updatedClient); |
| | | this.updateAppointmentDetail(this.client.id); |
| | | }); |
| | | private async readAppointment(): Promise<void> { |
| | | try { |
| | | const response = await appointmentService.recordRead(this.client.id); |
| | | if (response !== null) { |
| | | const updatedClient = { ...this.client }; |
| | | updatedClient.consultantReadTime = new Date().toString(); |
| | | this.updateMyAppointmentList(updatedClient); |
| | | this.updateAppointmentDetail(this.client.id); |
| | | } else { |
| | | throw new Error('appointmentService.recordRead returned null-like value.'); |
| | | } |
| | | } catch (error) { |
| | | console.error('An error occurred while reading appointment:', error); |
| | | // 可以在此處處理錯誤或回傳預設值 |
| | | throw error; |
| | | } |
| | | } |
| | | |
| | | |
| | | private clearAppointmentIdFromMsg() { |
| | | this.storageClearAppointmentIdFromMsg(); |