保誠-保戶業務員媒合平台
Tomas
2023-08-05 77f7439922a62944da14e37b0868aca974628464
Fixed: [弱掃] p21.2 Bad use of null-like value
修改1個檔案
24 ■■■■ 已變更過的檔案
PAMapp/components/Client/ClientCard.vue 24 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/components/Client/ClientCard.vue
@@ -306,14 +306,24 @@
        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();