mirror of
https://github.com/keven1024/015.git
synced 2026-05-26 07:08:02 +00:00
fix(front): update success message for copy action in CopyButton and refactor token handling in FileShareView
This commit is contained in:
@@ -21,7 +21,7 @@ const { t } = useI18n()
|
|||||||
async () => {
|
async () => {
|
||||||
await copy(props?.value)
|
await copy(props?.value)
|
||||||
isCopy = true
|
isCopy = true
|
||||||
toast.success(t('page.result.text.copySuccess'))
|
toast.success(t('common.copySuccess'))
|
||||||
await asyncWait(3000)
|
await asyncWait(3000)
|
||||||
isCopy = false
|
isCopy = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,22 +19,24 @@ const props = defineProps<{
|
|||||||
|
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const { downloadFile, getShareToken } = useMyAppShare()
|
const { downloadFile, getShareToken } = useMyAppShare()
|
||||||
|
const token = ref<string>()
|
||||||
|
|
||||||
const handleDownload = async () => {
|
const handleDownload = async () => {
|
||||||
const { id } = props?.data || {}
|
const { id } = props?.data || {}
|
||||||
try {
|
try {
|
||||||
let token = null
|
if (!token.value) {
|
||||||
if (props?.data?.has_password) {
|
if (props?.data?.has_password) {
|
||||||
token = await showDrawer({
|
token.value = await showDrawer({
|
||||||
render: ({ ...rest }) => h(PasswallShareDrawer, { ...rest, share_id: id }),
|
render: ({ ...rest }) => h(PasswallShareDrawer, { ...rest, share_id: id }),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
token = await getShareToken(id)
|
token.value = await getShareToken(id)
|
||||||
|
}
|
||||||
|
if (!token.value) {
|
||||||
|
throw new Error(t('page.shareView.fileShare.getTokenFailed'))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!token) {
|
downloadFile(token.value)
|
||||||
throw new Error(t('page.shareView.fileShare.getTokenFailed'))
|
|
||||||
}
|
|
||||||
downloadFile(token)
|
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
toast.error(error?.data?.message || error?.message || error)
|
toast.error(error?.data?.message || error?.message || error)
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user