fix(front): update success message for copy action in CopyButton and refactor token handling in FileShareView

This commit is contained in:
keven1024
2026-04-28 08:20:01 +08:00
parent a14628718c
commit 2273c589f6
2 changed files with 14 additions and 12 deletions

View File

@@ -21,7 +21,7 @@ const { t } = useI18n()
async () => {
await copy(props?.value)
isCopy = true
toast.success(t('page.result.text.copySuccess'))
toast.success(t('common.copySuccess'))
await asyncWait(3000)
isCopy = false
}

View File

@@ -19,22 +19,24 @@ const props = defineProps<{
const queryClient = useQueryClient()
const { downloadFile, getShareToken } = useMyAppShare()
const token = ref<string>()
const handleDownload = async () => {
const { id } = props?.data || {}
try {
let token = null
if (!token.value) {
if (props?.data?.has_password) {
token = await showDrawer({
token.value = await showDrawer({
render: ({ ...rest }) => h(PasswallShareDrawer, { ...rest, share_id: id }),
})
} else {
token = await getShareToken(id)
token.value = await getShareToken(id)
}
if (!token) {
if (!token.value) {
throw new Error(t('page.shareView.fileShare.getTokenFailed'))
}
downloadFile(token)
}
downloadFile(token.value)
} catch (error: any) {
toast.error(error?.data?.message || error?.message || error)
} finally {