Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (this.loginScanQrcode) {
throw new Error('qrcode exist')
}
const result = await this.WXGetQRCode()
if (!result || !result.qr_code) {
log.verbose('PuppetPadchatManager', `emitLoginQrCode() result not found. Call WXInitialize() and try again ...`)
await this.WXInitialize()
// wait 1 second and try again
await new Promise(r => setTimeout(r, 1000))
return await this.emitLoginQrcode()
}
const fileBox = FileBox.fromBase64(result.qr_code, 'qrcode.jpg')
const qrcodeDecoded = await fileBoxToQrcode(fileBox)
this.loginScanQrcode = qrcodeDecoded
this.loginScanStatus = WXCheckQRCodeStatus.WaitScan
this.emit(
'scan',
this.loginScanQrcode,
this.loginScanStatus,
)
}