renamed "attachment" to "file" for consistency

This commit is contained in:
azivner
2018-03-27 22:11:06 -04:00
parent 913b6bb6f6
commit 7464835058
12 changed files with 75 additions and 75 deletions

View File

@@ -0,0 +1,29 @@
import noteDetailService from "./note_detail.js";
import treeService from "./tree.js";
import server from "./server.js";
function uploadFile() {
$("#file-upload").trigger('click');
}
$("#file-upload").change(async function() {
const formData = new FormData();
formData.append('upload', this.files[0]);
const resp = await $.ajax({
url: baseApiUrl + 'files/upload/' + noteDetailService.getCurrentNoteId(),
headers: server.getHeaders(),
data: formData,
type: 'POST',
contentType: false, // NEEDED, DON'T OMIT THIS
processData: false, // NEEDED, DON'T OMIT THIS
});
await treeService.reload();
await treeService.activateNode(resp.noteId);
});
export default {
uploadFile
}