Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-dimitru committed Sep 10, 2017
1 parent 61ec125 commit 3b94ee3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/client/fileUpload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { $ } from 'meteor/jquery';
import { Meteor } from 'meteor/meteor';
import { AutoForm } from 'meteor/aldeed:autoform';
import { Template } from 'meteor/templating';
Expand Down Expand Up @@ -48,8 +47,10 @@ Template.afFileUpload.helpers({
},
uploadedFile() {
const template = Template.instance();
var _id = template.fileId.get() || this.value;
if (typeof _id !== 'string' || _id.length === 0) return null;
const _id = template.fileId.get() || this.value;
if (typeof _id !== 'string' || _id.length === 0) {
return null;
}
return template.collection.findOne({_id:_id});
}
});
Expand Down Expand Up @@ -89,7 +90,7 @@ Template.afFileUpload.events({
upload.on('error', function (error) {
ctx.reset();
ctx.addValidationErrors([{name: template.inputName, type: 'uploadError', value: error.reason}]);
$(e.currentTarget).val('');
template.$(e.currentTarget).val('');
return;
});

Expand Down

0 comments on commit 3b94ee3

Please sign in to comment.