diff --git a/src/components/namespaces/EditNamespace.vue b/src/components/namespaces/EditNamespace.vue index 1ca089a9..d83b1587 100644 --- a/src/components/namespaces/EditNamespace.vue +++ b/src/components/namespaces/EditNamespace.vue @@ -20,13 +20,22 @@ - - - - + +
+
+ +
+
+ +
+
@@ -91,6 +100,21 @@ this.handleError(e) }) }, + 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')}}) + .then(() => { + this.handleSuccess({message: 'The namespace was successfully deleted.'}) + router.push({name: 'home'}) + }) + .catch(e => { + this.handleError(e) + }) + }, handleError(e) { this.loading = false message.error(e, this) @@ -104,5 +128,7 @@ \ No newline at end of file diff --git a/src/main.js b/src/main.js index 54458a17..49edc740 100644 --- a/src/main.js +++ b/src/main.js @@ -20,6 +20,7 @@ import { faTasks } from '@fortawesome/free-solid-svg-icons' import { faCog } from '@fortawesome/free-solid-svg-icons' import { faAngleRight } from '@fortawesome/free-solid-svg-icons' import { faLayerGroup } from '@fortawesome/free-solid-svg-icons' +import { faTrashAlt } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' library.add(faSignOutAlt) @@ -29,6 +30,7 @@ library.add(faTasks) library.add(faCog) library.add(faAngleRight) library.add(faLayerGroup) +library.add(faTrashAlt) Vue.component('icon', FontAwesomeIcon)