Skip to content

Commit

Permalink
Improved: resetting the fieldMapping on appropriate time(hotwax#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
R-Sourabh committed Oct 14, 2024
1 parent f819f30 commit 7820e50
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/views/BulkUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,19 @@ onIonViewDidEnter(async() => {
content.value = []
fileName.value = null
fieldMapping.value = Object.keys(fields).reduce((fieldMapping, field) => {
fieldMapping[field] = ""
return fieldMapping;
}, {})
resetFieldMapping();
file.value.value = null;
await store.dispatch('user/getFieldMappings')
await store.dispatch('count/fetchCycleCountImportSystemMessages')
})
function resetDefaults() {
function resetFieldMapping() {
fieldMapping.value = Object.keys(fields).reduce((fieldMapping, field) => {
fieldMapping[field] = ""
return fieldMapping;
}, {})
}
function resetDefaults() {
resetFieldMapping();
uploadedFile.value = {}
content.value = []
fileName.value = null
Expand Down Expand Up @@ -217,6 +217,7 @@ async function parse(event) {
fileColumns.value = Object.keys(content.value[0]);
showToast(translate("File uploaded successfully."));
fileUploaded.value =!fileUploaded.value;
resetFieldMapping();
} else {
showToast(translate("No new file upload. Please try again."));
}
Expand Down

0 comments on commit 7820e50

Please sign in to comment.