fix(partner): resolve WeChat image picker auth denied on store create
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -51,12 +51,17 @@ export async function chooseWechatImages(
|
||||
const sourceType = options.sourceType ?? ['album', 'camera'];
|
||||
|
||||
if (platform === 'wechat-h5') {
|
||||
const pageUrl = typeof window !== 'undefined' ? window.location.href.split('#')[0] : '';
|
||||
await ensureJssdkReady({
|
||||
apiBase: config.apiBase ?? '/api/v1',
|
||||
clientApp: config.clientApp,
|
||||
getAccessToken: config.getAccessToken,
|
||||
url: pageUrl,
|
||||
jsApiList: ['chooseImage', 'getLocalImgData'],
|
||||
});
|
||||
if (!window.wx?.chooseImage) return null;
|
||||
if (!window.wx?.chooseImage) {
|
||||
throw new Error('微信选图接口不可用,请刷新页面后重试');
|
||||
}
|
||||
|
||||
const localIds = await new Promise<string[]>((resolve, reject) => {
|
||||
window.wx!.chooseImage!({
|
||||
|
||||
Reference in New Issue
Block a user