fix;合并修复问题
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useId, useRef, useState } from 'react';
|
||||
import { uploadFileToOss, type OssMediaType } from '../lib/upload';
|
||||
import { toastError } from '../lib/toast';
|
||||
import {
|
||||
authorizePartnerWechat,
|
||||
fetchClientConfig,
|
||||
@@ -84,7 +85,9 @@ export default function OssUploadField({
|
||||
|
||||
async function uploadSelectedFile(file: File) {
|
||||
if (file.size > DEFAULT_MAX_MB * 1024 * 1024) {
|
||||
setError(`文件不能超过 ${DEFAULT_MAX_MB}MB`);
|
||||
const text = `文件不能超过 ${DEFAULT_MAX_MB}MB`;
|
||||
setError(text);
|
||||
toastError(text);
|
||||
return;
|
||||
}
|
||||
setUploading(true);
|
||||
@@ -106,7 +109,9 @@ export default function OssUploadField({
|
||||
try {
|
||||
await authorizePartnerWechat();
|
||||
} catch (e) {
|
||||
setError(e instanceof Error ? e.message : '微信授权失败');
|
||||
const text = e instanceof Error ? e.message : '微信授权失败';
|
||||
setError(text);
|
||||
toastError(text);
|
||||
setAuthorizing(false);
|
||||
}
|
||||
}
|
||||
@@ -132,7 +137,9 @@ export default function OssUploadField({
|
||||
setError('');
|
||||
|
||||
if (useWechatPicker && needsAuth) {
|
||||
setError('请先完成微信授权后再上传照片');
|
||||
const text = '请先完成微信授权后再上传照片';
|
||||
setError(text);
|
||||
toastError(text);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user