保誠-保戶業務員媒合平台
Tomas
2023-08-05 3c17a06c6b1e099a618957bf7c1ddf93e0244a22
Fixed: [弱掃] p17.2 Bad use of null-like value
修改1個檔案
31 ■■■■■ 已變更過的檔案
PAMapp/pages/questionnaire/_agentNo.vue 31 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/questionnaire/_agentNo.vue
@@ -452,21 +452,30 @@
    ////////////////////////////////////////////////////////////////////////////
    sentDemand() {
    async sentDemand() {
      if (this.isEditBtn) {
        this.editAppointmentDemand();
        await this.editAppointmentDemand();
      } else {
        queryConsultantService.addFavoriteConsultant([{ agentNo: this.$route.params.agentNo, createdTime: new Date().toISOString()}]).then(res => this.sentAppointmentDemand());
      }
       const editSettingInfo: UserSetting = {
          name: this.myRequest.name,
          phone: this.myRequest.phone,
          email: this.myRequest.email,
        // 使用 async/await 來等待異步操作的回傳結果
        const addFavoriteAgentList = [{ agentNo: this.$route.params.agentNo, createdTime: new Date().toISOString() }];
        const response = await queryConsultantService.addFavoriteConsultant(addFavoriteAgentList);
        // 確保異步操作的回傳結果不為 null 或 undefined
        if (response !== null) {
          await this.sentAppointmentDemand();
        } else {
          throw new Error('queryConsultantService.addFavoriteConsultant returned null-like value.');
        }
      }
      accountSettingService.updateAccountSetting(editSettingInfo).then((_) => {
          this.storageUserInfo(this.userInfo);
      });
      const editSettingInfo: UserSetting = {
        name: this.myRequest.name,
        phone: this.myRequest.phone,
        email: this.myRequest.email,
      };
      await accountSettingService.updateAccountSetting(editSettingInfo);
      this.storageUserInfo(this.userInfo);
    }
    private editAppointmentDemand() {