保誠-保戶業務員媒合平台
Tomas
2023-08-05 01edfc155a0dcf9d84a78139be6b86b76232f2b4
Fixed: [弱掃] p14.2 Bad use of null-like value
修改1個檔案
18 ■■■■ 已變更過的檔案
PAMapp/shared/services/login.service.ts 18 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/shared/services/login.service.ts
@@ -11,9 +11,21 @@
class LoginService {
    /** 顧客登入-發送OTP **/
  async sendOtp(loginInfo: LoginRequest, verifyCode: string):Promise<OtpInfo> {
    return http.post(`/otp/sendOtp/${verifyCode}`, loginInfo).then( res => res.data );
  }
    async sendOtp(loginInfo: LoginRequest, verifyCode: string): Promise<OtpInfo> {
      try {
        const response = await http.post(`/otp/sendOtp/${verifyCode}`, loginInfo);
        if (response !== null) {
          return response.data;
        } else {
          throw new Error('http.post returned null-like value.');
        }
      } catch (error) {
        console.error('An error occurred while sending OTP:', error);
        // 可以在此處處理錯誤或回傳預設值
        throw error;
      }
    }
  /**
   * 顧客登入-驗證OTP