api-client/components/collections/request.vue

45 lines
1.2 KiB
Vue
Raw Normal View History

2019-10-01 22:20:23 +00:00
<template>
<div @click='selectRequest()'>
{{request.name}}
2019-10-17 16:56:19 +00:00
<button class="add-button" @click="editRequest">e</button>
2019-10-17 15:23:26 +00:00
<button class="add-button" @click="removeRequest">x</button>
2019-10-01 22:20:23 +00:00
</div>
</template>
2019-10-17 15:23:26 +00:00
<style scoped>
.add-button {
padding: 0;
width: 20px;
margin: 0;
height: 20px;
border-radius: 50%;
}
</style>
2019-10-01 22:20:23 +00:00
<script>
export default {
props: {
request: Object,
2019-10-17 15:23:26 +00:00
collectionIndex: Number,
folderIndex: Number,
requestIndex: Number,
2019-10-01 22:20:23 +00:00
},
methods: {
selectRequest() {
this.$store.commit('postwoman/selectRequest', { request: this.request });
},
2019-10-17 16:56:19 +00:00
editRequest() {
this.request.requestIndex = this.requestIndex;
this.$store.commit('postwoman/editRequest', { request: this.request });
},
2019-10-17 15:23:26 +00:00
removeRequest() {
if (!confirm("Are you sure you want to remove this request?")) return;
this.$store.commit('postwoman/removeRequest', {
collectionIndex: this.collectionIndex,
folderIndex: this.folderIndex,
requestIndex: this.requestIndex,
});
},
},
};
2019-10-01 22:20:23 +00:00
</script>