Removed event bus and switched to vuex. Implemented vue dropzone.
This commit is contained in:
20
assets/js/api/file.js
Normal file
20
assets/js/api/file.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import axios from 'axios';
|
||||
|
||||
export default {
|
||||
deleteFile: function (fileId) {
|
||||
return axios.get(window.location.origin + '/file/delete/' + fileId);
|
||||
},
|
||||
getFiles: function (bookId) {
|
||||
return axios.get(this.getFilesEndpoint(bookId), {
|
||||
headers: {
|
||||
'accept': 'application/json'
|
||||
}
|
||||
});
|
||||
},
|
||||
getFilesEndpoint: function (bookId) {
|
||||
if (bookId) {
|
||||
return `/api/books/${bookId}/files`;
|
||||
}
|
||||
return `/api/files`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user