diff --git a/src/components/GunForm.vue b/src/components/GunForm.vue
index a2a740b..73f9178 100644
--- a/src/components/GunForm.vue
+++ b/src/components/GunForm.vue
@@ -53,7 +53,7 @@
@@ -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: () => {
diff --git a/src/pages/Edit.vue b/src/pages/Edit.vue
index 39b8998..d2ad10f 100644
--- a/src/pages/Edit.vue
+++ b/src/pages/Edit.vue
@@ -1,7 +1,7 @@
-
+
@@ -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
+ })
}
}
})