aboutsummaryrefslogtreecommitdiff
path: root/src/components/new_brand.vue
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2023-12-03 22:32:59 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2023-12-03 22:32:59 +0530
commitae45ad12a5840348550078cb62042e813a3492b5 (patch)
treed8e041df5b4b5a1a41666df17018085c391d4615 /src/components/new_brand.vue
parent37ef1ab2f544a05b5878c5bdaafd37155a054289 (diff)
updating brands table upon addition/deletion0.1.1
Diffstat (limited to 'src/components/new_brand.vue')
-rw-r--r--src/components/new_brand.vue11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/components/new_brand.vue b/src/components/new_brand.vue
index 8b4893a..77d83da 100644
--- a/src/components/new_brand.vue
+++ b/src/components/new_brand.vue
@@ -1,8 +1,10 @@
<script setup lang="js">
-import { ref } from 'vue'
+import { ref, toRaw } from 'vue'
import axios from 'axios'
import { useToast } from 'vue-toast-notification'
+const emit = defineEmits(["added"])
+
const toast = useToast({
position: 'top-right'
})
@@ -12,12 +14,13 @@ const brandName = ref('')
const submit = async (e) => {
e.preventDefault()
try {
- const res = await axios.post('/brand', {
- name: brandName._value
+ await axios.post('/brand', {
+ name: toRaw(brandName.value)
})
+
toast.success('Successfully added a new brand.')
+ emit("added")
brandName.value = ''
- // TODO: refresh items list
} catch (err) {
toast.error('An unhandled exception occoured. Please check logs')
console.error(err)