From a26ab9f60314420aad1c7d2a328d299f503532fa Mon Sep 17 00:00:00 2001
From: Vidhu Kant Sharma <vidhukant@vidhukant.com>
Date: Sun, 11 Feb 2024 12:43:13 +0530
Subject: removed annoying notifications on HTTP 204

---
 src/components/new_item.vue | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/components/new_item.vue')

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(() => {
     </div>
     <div class="col-md-3">
       <label for="item-brand-input" class="form-label">Brand</label>
+
       <select
         class="form-select"
         aria-label="Select Brand"
         id="item-brand-input"
         v-model="itemBrand"
       >
-        <option selected disabled value="0">Select Brand</option>
+        <option v-if="allBrands.length == 0" selected disabled value="null">No brands added in OpenBills!</option>
+        <option v-else selected disabled value="null">Select Brand</option>
 
         <option v-for="brand in allBrands" :value="brand" :key="brand.id">
           {{ brand.Name }}
-- 
cgit v1.2.3

