aboutsummaryrefslogtreecommitdiff
path: root/src/components/items_table.vue
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2024-02-11 12:43:13 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2024-02-11 12:43:13 +0530
commita26ab9f60314420aad1c7d2a328d299f503532fa (patch)
treec71eac7944bde25a0a4ec383ac3fd5030e7ac61a /src/components/items_table.vue
parentbc639c89eb5530e7ffeae864ec7fa170e5faccc2 (diff)
removed annoying notifications on HTTP 204
Diffstat (limited to 'src/components/items_table.vue')
-rw-r--r--src/components/items_table.vue34
1 files changed, 17 insertions, 17 deletions
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(() => {
</div>
</div>
+ <div v-else-if="allItems.length === 0" class="w-100 d-flex justify-content-center">
+ <p>No items added! <RouterLink to="/item/new">Add new.</RouterLink></p>
+ </div>
+
<table v-else class="table table-striped table-hover">
<thead>
<tr>