From 3bd8d119ba88e940932eca50be406d50d73040fb Mon Sep 17 00:00:00 2001 From: Pitu Date: Wed, 24 Apr 2019 08:36:28 +0000 Subject: Refactor a bit since we globally catch API exceptions --- src/site/pages/dashboard/users.vue | 45 ++++++++++++-------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) (limited to 'src/site/pages/dashboard/users.vue') diff --git a/src/site/pages/dashboard/users.vue b/src/site/pages/dashboard/users.vue index 4ef3e5b..9326243 100644 --- a/src/site/pages/dashboard/users.vue +++ b/src/site/pages/dashboard/users.vue @@ -226,33 +226,20 @@ export default { }, methods: { async getUsers() { - try { - const response = await this.$axios.$get(`admin/users`); - this.users = response.users; - console.log(this.users); - } catch (error) { - this.$onPromiseError(error); - } + const response = await this.$axios.$get(`admin/users`); + this.users = response.users; }, async changeEnabledStatus(row) { - try { - const response = await this.$axios.$post(`admin/users/${row.enabled ? 'enable' : 'disable'}`, { - id: row.id - }); - this.$toast.open(response.message); - } catch (error) { - this.$onPromiseError(error); - } + const response = await this.$axios.$post(`admin/users/${row.enabled ? 'enable' : 'disable'}`, { + id: row.id + }); + this.$toast.open(response.message); }, async changeIsAdmin(row) { - try { - const response = await this.$axios.$post(`admin/users/${row.isAdmin ? 'promote' : 'demote'}`, { - id: row.id - }); - this.$toast.open(response.message); - } catch (error) { - this.$onPromiseError(error); - } + const response = await this.$axios.$post(`admin/users/${row.isAdmin ? 'promote' : 'demote'}`, { + id: row.id + }); + this.$toast.open(response.message); }, promptPurgeFiles(row) { this.$dialog.confirm({ @@ -261,14 +248,10 @@ export default { }); }, async purgeFiles(row) { - try { - const response = await this.$axios.$post(`admin/users/purge`, { - id: row.id - }); - this.$toast.open(response.message); - } catch (error) { - this.$onPromiseError(error); - } + const response = await this.$axios.$post(`admin/users/purge`, { + id: row.id + }); + this.$toast.open(response.message); } } }; -- cgit v1.2.3