last hope failed, maybe now

This commit is contained in:
2023-08-07 22:04:04 -04:00
parent b7b03f8bab
commit 26da7c6281
2 changed files with 14 additions and 7 deletions

View File

@@ -53,7 +53,7 @@
<div class="w-full mt-5">
<div class="flex gap-2" style="flex-direction: column">
<label for="date_purchased">Date Purchased</label>
<Calendar v-model="gun.date_purchased"/>
<Calendar date-format="mm/dd/yy" v-model="gun.date_purchased"/>
</div>
</div>
<div class="w-full mt-5">
@@ -93,9 +93,7 @@ export default defineComponent({
props: {
loading: {
type: Boolean,
default: () => {
return false
}
default: false
},
gun: {
type: Object,
@@ -110,7 +108,7 @@ export default defineComponent({
methods: {
confirm() {
this.$confirm.require({
message: 'Are you sure you want to proceed?',
message: 'Are you sure you want to delete this gun?',
header: 'Confirmation',
icon: 'pi pi-exclamation-triangle',
accept: () => {

View File

@@ -1,7 +1,7 @@
<template>
<div class="w-full flex flex-row flex-wrap justify-around">
<div class="w-full lg:w-1/2 m-5">
<GunForm @upload="getGun" v-if="gun" @save="save" :gun="gun"/>
<GunForm :loading="loading" @upload="getGun" v-if="gun" @save="save" :gun="gun"/>
</div>
<div class="mt-10 w-full lg:w-1/2 m-5">
<Card>
@@ -36,11 +36,13 @@ import GunForm from "../components/GunForm.vue";
interface Data {
gun: Guns | null
loading: boolean
}
export default defineComponent({
components: {GunForm},
data: (): Data => ({
loading: false,
gun: null
}),
created() {
@@ -65,7 +67,14 @@ export default defineComponent({
})
},
save() {
this.loading = true
axios.put(import.meta.env.VITE_API + `/gun/${this.$route.params.id}`, this.gun)
.then(() => {
this.getGun()
})
.finally(() => {
this.loading = false
})
}
}
})