diff --git a/src/composables/downloadFile.js b/src/composables/downloadFile.js index 302836e09e9..0c4e8edb653 100644 --- a/src/composables/downloadFile.js +++ b/src/composables/downloadFile.js @@ -5,18 +5,19 @@ import { exportFile } from 'quasar'; const { getTokenMultimedia } = useSession(); const token = getTokenMultimedia(); -const appUrl = (await getUrl('', 'lilium')).replace('/#/', ''); export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) { + const appUrl = await getAppUrl(); const response = await axios.get( url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`, - { responseType: 'blob' } + { responseType: 'blob' }, ); download(response); } export async function downloadDocuware(url, params) { + const appUrl = await getAppUrl(); const response = await axios.get(`${appUrl}/api/` + url, { responseType: 'blob', params, @@ -32,3 +33,7 @@ function download(response) { exportFile(filename, response.data); } + +async function getAppUrl() { + return (await getUrl('', 'lilium')).replace('/#/', ''); +}