derp, helper method rename

This commit is contained in:
2023-08-07 21:17:33 -04:00
parent 5183277554
commit b7b03f8bab
4 changed files with 32 additions and 12 deletions

View File

@@ -79,12 +79,11 @@
<router-link to="/guns">
<Button class="p-button-warning ml-3" icon="fa-sharp fa-light fa-times" label="Cancel"/>
</router-link>
<Button @click="deleteGun" v-if="gun.id" class="p-button-danger ml-3" icon="fa-sharp fa-light fa-trash" label="Delete"/>
<Button @click="confirm" v-if="gun.id" class="p-button-danger ml-3" icon="fa-sharp fa-light fa-trash" label="Delete"/>
</div>
</div>
</template>
</Card>
</template>
<script lang="ts">
import {defineComponent} from "vue"
@@ -109,6 +108,18 @@ export default defineComponent({
}
},
methods: {
confirm() {
this.$confirm.require({
message: 'Are you sure you want to proceed?',
header: 'Confirmation',
icon: 'pi pi-exclamation-triangle',
accept: () => {
this.deleteGun()
},
reject: () => {
}
});
},
deleteGun() {
axios.delete(`${import.meta.env.VITE_API}/gun/${this.gun.id}`)
.then(() => {