From 3d9fdbb62e3476ca6078898e8be36eb0d986e254 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Mon, 18 Mar 2024 15:57:35 +0530 Subject: [PATCH 1/2] Fixed: duplicate toast message on file upload(#267) 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 --- src/mixins/parseFileMixin.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/mixins/parseFileMixin.ts b/src/mixins/parseFileMixin.ts index 5f73c3df..669efc81 100644 --- a/src/mixins/parseFileMixin.ts +++ b/src/mixins/parseFileMixin.ts @@ -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; } } } \ No newline at end of file From 37311cca9f632e1491fe398ca6f8c5ddf4b59989 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Mon, 18 Mar 2024 16:01:57 +0530 Subject: [PATCH 2/2] Improved: code formatting(#267) --- src/mixins/parseFileMixin.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/mixins/parseFileMixin.ts b/src/mixins/parseFileMixin.ts index 669efc81..9cbcd6c8 100644 --- a/src/mixins/parseFileMixin.ts +++ b/src/mixins/parseFileMixin.ts @@ -5,10 +5,7 @@ export default { methods: { async parseCsv(file: any) { store.dispatch('order/updateFileName', file.name); - const csvData = await parseCsv(file).then(res => { - return res; - }) - return csvData; + return await parseCsv(file).then(res => res) } } } \ No newline at end of file