Browse Source

send filename, do not upload if not file is set

pull/1/head
Jonathan Cobb 4 years ago
parent
commit
fbb91b5da5
2 changed files with 5 additions and 0 deletions
  1. +1
    -0
      src/_services/system.service.js
  2. +4
    -0
      src/admin/ModelSetupPage.vue

+ 1
- 0
src/_services/system.service.js View File

@@ -70,6 +70,7 @@ function createEntity(entityConfig, json, messages, errors) {
function modelSetup(file, messages, errors) { function modelSetup(file, messages, errors) {
let formData = new FormData(); let formData = new FormData();
formData.append('file', file); formData.append('file', file);
formData.append('name', file.name);
return fetch(`${config.apiUrl}/me/model`, util.postFileWithAuth(formData)) return fetch(`${config.apiUrl}/me/model`, util.postFileWithAuth(formData))
.then(util.handleCrudResponse(messages, errors)) .then(util.handleCrudResponse(messages, errors))
.then(entity => { return entity; }); .then(entity => { return entity; });


+ 4
- 0
src/admin/ModelSetupPage.vue View File

@@ -110,6 +110,10 @@
console.log('handleFileUpload, set this.file='+JSON.stringify(this.file.name)); console.log('handleFileUpload, set this.file='+JSON.stringify(this.file.name));
}, },
uploadModel(e) { uploadModel(e) {
if (this.file === null) {
console.log('uploadModel: no file set, not uploading');
return;
}
this.modelSetup({file: this.file, messages: this.messages, errors: this.errors}); this.modelSetup({file: this.file, messages: this.messages, errors: this.errors});
this.showingUploadDialog = false; this.showingUploadDialog = false;
}, },


Loading…
Cancel
Save