✨ 优化发送上传状态与移动端界面
This commit is contained in:
1 parent
c2f0bf1675
commit
84ddf92b20
4 files changed
+52
-5
No files matched your search
@@ -14,6 +14,7 @@ type UseSendSubmitOptions = {
|
||||
translate: Translate
|
||||
onProgress: (progress: number) => void
|
||||
onHashCalculated: (hash: string) => void
|
||||
onStatus?: (status: 'idle' | 'uploading' | 'success' | 'error') => void
|
||||
}
|
||||
|
||||
type SubmitFileOptions = {
|
||||
@@ -106,9 +107,17 @@ export function useSendSubmit(options: UseSendSubmitOptions) {
|
||||
throw new Error(options.translate('send.messages.selectFile'))
|
||||
}
|
||||
|
||||
return enableChunk
|
||||
? handleChunkUpload(fileToUpload, expireValue, expireStyle)
|
||||
: handlePresignedUpload(fileToUpload, expireValue, expireStyle)
|
||||
options.onStatus?.('uploading')
|
||||
try {
|
||||
const response = enableChunk
|
||||
? await handleChunkUpload(fileToUpload, expireValue, expireStyle)
|
||||
: await handlePresignedUpload(fileToUpload, expireValue, expireStyle)
|
||||
if (response?.code === 200) options.onStatus?.('success')
|
||||
return response
|
||||
} catch (error) {
|
||||
options.onStatus?.('error')
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
const submitText = ({ text, expireValue, expireStyle }: SubmitTextOptions) =>
|
||||
|
||||
Reference in new issue
Block a user