message: feat: handle wx login code
diff: @@ -120,14 +120,19 @@ export class Authing {
  await this.storage.set(getWxLoginCodeKey(this.options.appId), code)
  return code
  } catch (e) {
  + error('cacheWxLoginCode', e)
  return ''
  }
  }
  private async resetWxLoginCode (): Promise<string> {
  const next = async () => {
  - const { code } = await AuthingMove.login()
  - await this.cacheWxLoginCode(code)
  + try {
  + const wxLoginRes = await AuthingMove.login()
  + await this.cacheWxLoginCode(wxLoginRes.code)
  + } catch (e) {
  + error('resetWxLoginCode', e)
  + }
  }
  try {
  @@ -154,6 +159,9 @@ export class Authing {
  const { extIdpConnidentifier, connection, wechatMiniProgramCodePayload, options } = data
  + let retryCount = 0
  +
  + const login = async (): Promise<Maybe<LoginState>> => {
  const code = await this.resetWxLoginCode()
  const _data: WxCodeLoginOptions = {
  @@ -172,11 +180,17 @@ export class Authing {
  return loginRes
  }
  - await this.resetWxLoginCode()
  + if (retryCount === 0) {
  + retryCount += 1
  + return await login()
  + }
  return null
  }
  + return await login()
  + }
  +
  async loginByPhone(
  data: LoginByPhoneOptions
  ): Promise<Maybe<LoginState>> {
  @@ -188,7 +202,10 @@ export class Authing {
  const { extIdpConnidentifier, connection, wechatMiniProgramPhonePayload, options } = data
  - const { code } = await AuthingMove.login()
  + let retryCount = 0
  +
  + const login = async (): Promise<Maybe<LoginState>> => {
  + const code = await this.resetWxLoginCode()
  const _data: WxPhoneLoginOptions = {
  connection: connection || 'wechat_mini_program_phone',
  @@ -206,11 +223,17 @@ export class Authing {
  return loginRes
  }
  - await this.resetWxLoginCode()
  + if (retryCount === 0) {
  + retryCount += 1
  + return await login()
  + }
  return null
  }
  + return await login()
  + }
  +
  async loginByPassword(
  data: PasswordLoginOptions
  ): Promise<Maybe<LoginState>> {
  