Deleting a namespace now uses the modal
This commit is contained in:
parent
c8a305f930
commit
cb6eb2d1ca
1 changed files with 11 additions and 6 deletions
|
@ -29,7 +29,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="column is-1">
|
<div class="column is-1">
|
||||||
<button @click="deleteNamespace()" class="button is-danger is-fullwidth" :class="{ 'is-loading': loading}">
|
<button @click="showDeleteModal = true" class="button is-danger is-fullwidth" :class="{ 'is-loading': loading}">
|
||||||
<span class="icon is-small">
|
<span class="icon is-small">
|
||||||
<icon icon="trash-alt"/>
|
<icon icon="trash-alt"/>
|
||||||
</span>
|
</span>
|
||||||
|
@ -38,6 +38,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<modal
|
||||||
|
v-if="showDeleteModal"
|
||||||
|
@close="showDeleteModal = false"
|
||||||
|
v-on:submit="deleteNamespace()">
|
||||||
|
<span slot="header">Delete the namespace</span>
|
||||||
|
<p slot="text">Are you sure you want to delete this namespace and all of its contents?
|
||||||
|
<br/>This includes lists & tasks and <b>CANNOT BE UNDONE!</b></p>
|
||||||
|
</modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -54,6 +63,7 @@
|
||||||
namespace: {title: '', description:''},
|
namespace: {title: '', description:''},
|
||||||
error: '',
|
error: '',
|
||||||
loading: false,
|
loading: false,
|
||||||
|
showDeleteModal: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
|
@ -101,11 +111,6 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deleteNamespace() {
|
deleteNamespace() {
|
||||||
// TODO: add better looking modal to ask the user if he is sure
|
|
||||||
if (!confirm('Are you sure you want to delete this namespace and all of its contents? This includes lists & tasks and CANNOT BE UNDONE!')) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
HTTP.delete(`namespaces/` + this.$route.params.id, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}})
|
HTTP.delete(`namespaces/` + this.$route.params.id, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.handleSuccess({message: 'The namespace was successfully deleted.'})
|
this.handleSuccess({message: 'The namespace was successfully deleted.'})
|
||||||
|
|
Loading…
Reference in a new issue