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 () => {
|
||||
await copy(props?.value)
|
||||
isCopy = true
|
||||
toast.success(t('page.result.text.copySuccess'))
|
||||
toast.success(t('common.copySuccess'))
|
||||
await asyncWait(3000)
|
||||
isCopy = false
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user