Skip to content

Commit

Permalink
Merge branch 'master' into fix/HD-26946
Browse files Browse the repository at this point in the history
  • Loading branch information
trev-dev committed Sep 18, 2024
2 parents 611ca49 + bd6530f commit fa42dd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 7 additions & 9 deletions frontend/src/components/DocumentUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
label="Document Type"
/>
<v-file-input
v-model="fileArray"
v-model="inputFile"
:rules="fileRules"
:accept="fileAccept"
placeholder="Select your file"
Expand Down Expand Up @@ -103,7 +103,7 @@ export default {
buttonKey: 0,
documentTypeCode: null,
fileAccept: '',
fileArray: [],
inputFile: null,
fileFormats: 'PDF, JPEG, and PNG',
fileInputError: [],
fileRules: [],
Expand All @@ -120,7 +120,7 @@ export default {
return getRequestStore().requestID;
},
dataReady () {
return this.validForm && this.fileArray;
return this.validForm && this.inputFile;
},
documentTypes() {
return sortBy(this.documentTypeCodes, ['displayOrder']).map(code =>
Expand Down Expand Up @@ -170,13 +170,12 @@ export default {
submitRequest() {
if (this.dataReady) {
try {
const [ file ] = this.fileArray;
this.active = true;
const reader = new FileReader();
reader.onload = this.uploadFile;
reader.onabort = this.handleFileReadErr;
reader.onerror = this.handleFileReadErr;
reader.readAsBinaryString(file);
reader.readAsBinaryString(this.inputFile);
} catch (e) {
this.handleFileReadErr();
throw e;
Expand All @@ -188,12 +187,11 @@ export default {
this.setErrorAlert('Sorry, an unexpected error seems to have occurred. Try uploading your files later.');
},
async uploadFile(env) {
const [ file ] = this.fileArray;
let document = {
documentTypeCode: this.documentTypeCode,
fileName: getFileNameWithMaxNameLength(file.name),
fileExtension: file.type,
fileSize: file.size,
fileName: getFileNameWithMaxNameLength(this.inputFile.name),
fileExtension: this.inputFile.type,
fileSize: this.inputFile.size,
documentData: btoa(env.target.result)
};
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/plugins/vuetify.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
VStepperWindow,
VStepperWindowItem,
VTable,
VTextarea,
VTextField,
VToolbar,
VToolbarTitle
Expand Down Expand Up @@ -94,6 +95,7 @@ export default new createVuetify({
VStepperWindow,
VStepperWindowItem,
VTable,
VTextarea,
VTextField,
VToolbar,
VToolbarTitle
Expand Down

0 comments on commit fa42dd1

Please sign in to comment.