Fixed: [弱掃] p5-Bad use of null-like value
| | |
| | | return http.post(`/otp/sendOtp/${verifyCode}`, loginInfo).then( res => res.data ); |
| | | } |
| | | |
| | | /** 顧客登入-驗證OTP **/ |
| | | /** |
| | | * 顧客登入-驗證OTP |
| | | * @param loginVerify 包含驗證相關資訊的物件 |
| | | * @returns 回傳驗證成功後的Token |
| | | */ |
| | | async loginVerify(loginVerify: LoginVerify):Promise<LoginSuccessToken>{ |
| | | return http.post('/otp/verify', loginVerify).then(res => res.data); |
| | | try { |
| | | const response = await http.post('/otp/verify', loginVerify); |
| | | if (response !== null) { |
| | | return response.data; |
| | | } else { |
| | | throw new Error('http.post returned null-like value.'); |
| | | } |
| | | } catch (error) { |
| | | // 可以在此處處理錯誤或回傳預設值 |
| | | console.error('An error occurred while verifying OTP:', error); |
| | | throw error; |
| | | } |
| | | } |
| | | |
| | | /** 顧客註冊 **/ |
| | | async register(registerInfo: RegisterInfo):Promise<LoginSuccessToken>{ |
| | | return http.post('/otp/register', registerInfo).then(res => res.data); |