Initial attempt trying to get file downloading to work

This commit is contained in:
Dane Everitt 2019-03-16 17:10:04 -07:00
parent 4e669771ca
commit 8955b5a660
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
8 changed files with 153 additions and 3 deletions

View file

@ -0,0 +1,14 @@
import http from "@/api/http";
// @ts-ignore
import route from '../../../../../../vendor/tightenco/ziggy/src/js/route';
/**
* Gets a download token for a file on the server.
*/
export function getDownloadToken(server: string, file: string): Promise<string | null> {
return new Promise((resolve, reject) => {
http.post(route('api.client.servers.files.download', { server, file }))
.then(response => resolve(response.data ? response.data.token || null : null))
.catch(reject);
});
}