Merge branch 'phatt' into development

This commit is contained in:
puri-ph4tt 2023-12-06 10:16:52 +07:00
commit f2be0f4af9

View file

@ -11,9 +11,18 @@ import FileIcon from '@/components/FileIcon.vue'
const { isFilePreview, fileInfo } = storeToRefs(useFileInfoStore()) const { isFilePreview, fileInfo } = storeToRefs(useFileInfoStore())
const { getType, getFormatDate, getSize } = useFileInfoStore() const { getType, getFormatDate, getSize } = useFileInfoStore()
async function downloadSubmit(path: any) { async function downloadSubmit(path: string | undefined) {
if (path) {
let formatPath: string
if (path.split('/').length - 1 === 3) {
const [cabinet, drawer, folder, file] = path.split('/') const [cabinet, drawer, folder, file] = path.split('/')
const formatPath = `/cabinet/${cabinet}/drawer/${drawer}/folder/${folder}/file/${file}` formatPath = `cabinet/${cabinet}/drawer/${drawer}/folder/${folder}/file/${file}`
} else {
const [cabinet, drawer, folder, subfolder, file] = path.split('/')
formatPath = `cabinet/${cabinet}/drawer/${drawer}/folder/${folder}/subfolder/${subfolder}/file/${file}`
}
const res = await axiosClient.get<EhrFile & { download: string }>( const res = await axiosClient.get<EhrFile & { download: string }>(
`${import.meta.env.VITE_API_ENDPOINT}${formatPath}`, `${import.meta.env.VITE_API_ENDPOINT}${formatPath}`,
) )
@ -32,6 +41,7 @@ async function downloadSubmit(path: any) {
a.download = res.data.fileName a.download = res.data.fileName
a.click() a.click()
}) })
}
} }
</script> </script>