Mercurial > gemma
diff client/src/views/Users.vue @ 406:40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Basic features for adding, changing, deleting users established
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 15 Aug 2018 15:14:23 +0200 |
parents | cb233a5a2ecd |
children | a9440a4826aa |
line wrap: on
line diff
--- a/client/src/views/Users.vue Wed Aug 15 12:20:16 2018 +0200 +++ b/client/src/views/Users.vue Wed Aug 15 15:14:23 2018 +0200 @@ -120,7 +120,25 @@ }, methods: { deleteUser(name) { - console.log("delete: " + name); + this.$store + .dispatch("usermanagement/deleteUser", { name: name }) + .then(() => { + this.submitted = false; + this.$store.dispatch("usermanagement/loadUsers").catch(error => { + const { status, data } = error.response; + app.$toast.error({ + title: "Backend Error", + message: `${status}: ${data.message}` + }); + }); + }) + .catch(error => { + const { status, data } = error.response; + app.$toast.error({ + title: "Backend Error", + message: `${status}: ${data.message}` + }); + }); }, addUser() { this.$store.commit("usermanagement/clearCurrentUser"); @@ -139,7 +157,7 @@ const { status, data } = error.response; app.$toast.error({ title: "Backend Error", - message: `${status}: ${data}` + message: `${status}: ${data.message}` }); }); },