Fixed: [弱掃] p14.2 Bad use of null-like value
| | |
| | | |
| | | 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 |