From a26ab9f60314420aad1c7d2a328d299f503532fa Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 11 Feb 2024 12:43:13 +0530 Subject: removed annoying notifications on HTTP 204 --- src/components/brands_table.vue | 4 ++++ src/components/customers_table.vue | 6 ++++-- src/components/invoice_header_editor.vue | 5 ++--- src/components/items_table.vue | 34 ++++++++++++++++---------------- src/components/new_item.vue | 8 ++++---- 5 files changed, 31 insertions(+), 26 deletions(-) (limited to 'src/components') diff --git a/src/components/brands_table.vue b/src/components/brands_table.vue index 20429ec..3a604b1 100644 --- a/src/components/brands_table.vue +++ b/src/components/brands_table.vue @@ -32,6 +32,10 @@ const handleDelete = async (id) => { +
+

No brands added!

+
+ diff --git a/src/components/customers_table.vue b/src/components/customers_table.vue index 163c6b1..3632291 100644 --- a/src/components/customers_table.vue +++ b/src/components/customers_table.vue @@ -19,8 +19,6 @@ const getAllCustomers = async () => { const res = await axios.get('/customer') if (res.status === 200) { allCustomers.value = res.data.data - } else if (res.status === 204) { - toast.warning('No records found') } } catch (err) { toast.error('An unhandled exception occoured. Please check logs') @@ -56,6 +54,10 @@ onMounted(() => { +
+

No customers added! Add new.

+
+
diff --git a/src/components/invoice_header_editor.vue b/src/components/invoice_header_editor.vue index ffc5fb0..83c5281 100644 --- a/src/components/invoice_header_editor.vue +++ b/src/components/invoice_header_editor.vue @@ -27,8 +27,6 @@ const getAllCustomers = async () => { const r = await axios.get('/customer') if (r.status === 200) { allCustomers.value = r.data.data - } else if (r.status === 204) { - toast.warning('No customers found') } } catch (err) { toast.error('An unhandled exception occoured. Please check logs') @@ -129,7 +127,8 @@ onMounted(() => { aria-label="Select Brand" id="item-brand-input" > - + + diff --git a/src/components/items_table.vue b/src/components/items_table.vue index b18c91d..f429eb8 100644 --- a/src/components/items_table.vue +++ b/src/components/items_table.vue @@ -14,23 +14,19 @@ const isLoading = ref(false) const getAllItems = async () => { allItems.value = [] - allBrands.value = [] - isLoading.value = true - - try { - const res = await axios.get('/item') - if (res.status === 200) { - allItems.value = res.data.data - } else if (res.status === 204) { - toast.warning('No records found') - } - - const r = await axios.get('/brand') - if (r.status === 200) { - allBrands.value = r.data.data - } else if (r.status === 204) { - toast.warning('No records found') - } + allBrands.value = [] + isLoading.value = true + + try { + const res = await axios.get('/item') + if (res.status === 200) { + allItems.value = res.data.data + } + + const r = await axios.get('/brand') + if (r.status === 200) { + allBrands.value = r.data.data + } } catch (err) { toast.error('An unhandled exception occoured. Please check logs') console.error(err) @@ -65,6 +61,10 @@ onMounted(() => { +
+

No items added! Add new.

+
+
diff --git a/src/components/new_item.vue b/src/components/new_item.vue index 8b1f3f6..e93d0ea 100644 --- a/src/components/new_item.vue +++ b/src/components/new_item.vue @@ -10,7 +10,7 @@ const toast = useToast({ const isLoading = ref(true) const item = ref(new Item()) -const itemBrand = ref({ id: 0, name: '' }) +const itemBrand = ref(null) const allBrands = ref([]) const getAllBrands = async () => { @@ -21,8 +21,6 @@ const getAllBrands = async () => { const r = await axios.get('/brand') if (r.status === 200) { allBrands.value = r.data.data - } else if (r.status === 204) { - toast.warning('No brands found') } } catch (err) { toast.error('An unhandled exception occoured. Please check logs') @@ -129,13 +127,15 @@ onMounted(() => {
+