chore: handle the file upload error

This commit is contained in:
Novice 2025-06-27 09:43:03 +08:00
parent 4a66d40210
commit ba46b2a5fb
2 changed files with 3 additions and 3 deletions

View File

@ -89,7 +89,7 @@ const MCPModal = ({
const remoteIcon = `https://www.google.com/s2/favicons?domain=${domain}&sz=128`
setIsFetchingIcon(true)
try {
const res = await uploadRemoteFileInfo(remoteIcon)
const res = await uploadRemoteFileInfo(remoteIcon, undefined, true)
setAppIcon({ type: 'image', url: res.url, fileId: extractFileId(res.url) || '' })
}
catch (e) {

View File

@ -337,8 +337,8 @@ export const verifyWebAppForgotPasswordToken: Fetcher<CommonResponse & { is_vali
export const changeWebAppPasswordWithToken: Fetcher<CommonResponse, { url: string; body: { token: string; new_password: string; password_confirm: string } }> = ({ url, body }) =>
post<CommonResponse>(url, { body }, { isPublicAPI: true })
export const uploadRemoteFileInfo = (url: string, isPublic?: boolean) => {
return post<{ id: string; name: string; size: number; mime_type: string; url: string }>('/remote-files/upload', { body: { url } }, { isPublicAPI: isPublic })
export const uploadRemoteFileInfo = (url: string, isPublic?: boolean, silent?: boolean) => {
return post<{ id: string; name: string; size: number; mime_type: string; url: string }>('/remote-files/upload', { body: { url } }, { isPublicAPI: isPublic, silent })
}
export const sendEMailLoginCode = (email: string, language = 'en-US') =>