Switched getting files with axios request to the api platform.

This commit is contained in:
krzysiej
2022-06-09 14:42:47 +02:00
parent 00820715ea
commit 67e970183f
5 changed files with 14 additions and 11 deletions

View File

@@ -69,13 +69,17 @@ export default {
return (bytes / Math.pow(1024, e)).toFixed(2) + ' ' + ' KMGTP'.charAt(e) + 'B';
},
getFiles: function () {
axios.get(this.getFilesEndpoint()).then(response => this.files = response.data)
axios.get(this.getFilesEndpoint(), {
headers: {
'accept': 'application/json'
}
}).then(response => this.files = response.data)
},
getFilesEndpoint: function () {
if (this.bookId) {
return '/book/' + this.bookId + '/files';
return `/api/books/${this.bookId}/files`;
}
return '/file/all';
return `/api/files`;
}
}
}