Skip to content

Commit

Permalink
Fixed: duplicate toast message on file upload(hotwax#267)
Browse files Browse the repository at this point in the history
Removed: unused check for file inside the mixin, as the same check is added before calling the mixin method
Removed: success and error toast message from the mixin as the toast message are already available on component level, and added them at component level will help in handling the case when unable to access 0th index of content when parsing is not performed properly
  • Loading branch information
ymaheshwari1 committed Mar 18, 2024
1 parent b740b23 commit 3d9fdbb
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/mixins/parseFileMixin.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import { translate } from "@/i18n";
import store from "@/store";
import { showToast, parseCsv } from "@/utils";
import { parseCsv } from "@/utils";

export default {
methods: {
async parseCsv(file: any) {
if (file) {
store.dispatch('order/updateFileName', file.name);
const csvData = await parseCsv(file).then( res => {
return res;
})
showToast(translate("File uploaded successfully"));
return csvData;
}
showToast(translate("Something went wrong, Please try again"));
store.dispatch('order/updateFileName', file.name);
const csvData = await parseCsv(file).then(res => {
return res;
})
return csvData;
}
}
}

0 comments on commit 3d9fdbb

Please sign in to comment.