diff options
Diffstat (limited to 'src/components/new_brand.vue')
-rw-r--r-- | src/components/new_brand.vue | 11 |
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) |