Fix file and backup downloading to use URL returned by server

This commit is contained in:
Dane Everitt
2020-04-06 20:28:14 -07:00
parent 4b19e65eb8
commit a924eb56cc
7 changed files with 198 additions and 59 deletions

View File

@@ -0,0 +1,9 @@
import http from '@/api/http';
export default (uuid: string, backup: string): Promise<string> => {
return new Promise((resolve, reject) => {
http.get(`/api/client/servers/${uuid}/backups/${backup}/download`)
.then(({ data }) => resolve(data.attributes.url))
.catch(reject);
});
};

View File

@@ -0,0 +1,9 @@
import http from '@/api/http';
export default (uuid: string, file: string): Promise<string> => {
return new Promise((resolve, reject) => {
http.get(`/api/client/servers/${uuid}/files/download`, { params: { file } })
.then(({ data }) => resolve(data.attributes.url))
.catch(reject);
});
};