import axios from 'axios'; import { MiniAppError, MiniAppErrorType } from '../miniAppError'; import BridgeFunction from './bridgeFunction'; class GenerateCodeImage extends BridgeFunction { name = 'generateCodeImage'; protected async executeFunction() { if (this.functionContext?.type === 'qrcode') { await axios .get('/generateqrcode', { params: { data: this.functionContext?.data }, }) .then((res: any) => { if (res?.data) { return this.cbHandler?.success(res?.data); } else { throw new MiniAppError( MiniAppErrorType.badRequestInsufficientParameter ); } }); } else { throw new MiniAppError(MiniAppErrorType.invalidJSAPIParams); } } } export default GenerateCodeImage;