diff options
| author | Pitu <[email protected]> | 2019-03-29 00:35:58 +0900 |
|---|---|---|
| committer | Pitu <[email protected]> | 2019-03-29 00:35:58 +0900 |
| commit | ea3e503d13b7be477c064b02b9b2e5a9ef06c9a9 (patch) | |
| tree | 8ffd0bef5e2e210ca28478d18c3876b73cc79784 /src/site/pages/dashboard/users.vue | |
| parent | Added axios package (diff) | |
| download | host.fuwn.me-ea3e503d13b7be477c064b02b9b2e5a9ef06c9a9.tar.xz host.fuwn.me-ea3e503d13b7be477c064b02b9b2e5a9ef06c9a9.zip | |
Added middleware for pages and switched to $axios
Diffstat (limited to 'src/site/pages/dashboard/users.vue')
| -rw-r--r-- | src/site/pages/dashboard/users.vue | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/site/pages/dashboard/users.vue b/src/site/pages/dashboard/users.vue index 820969a..4ef3e5b 100644 --- a/src/site/pages/dashboard/users.vue +++ b/src/site/pages/dashboard/users.vue @@ -207,6 +207,7 @@ export default { components: { Sidebar }, + middleware: ['auth', 'admin'], data() { return { users: [] @@ -226,8 +227,8 @@ export default { methods: { async getUsers() { try { - const response = await this.axios.get(`${this.config.baseURL}/admin/users`); - this.users = response.data.users; + const response = await this.$axios.$get(`admin/users`); + this.users = response.users; console.log(this.users); } catch (error) { this.$onPromiseError(error); @@ -235,20 +236,20 @@ export default { }, async changeEnabledStatus(row) { try { - const response = await this.axios.post(`${this.config.baseURL}/admin/users/${row.enabled ? 'enable' : 'disable'}`, { + const response = await this.$axios.$post(`admin/users/${row.enabled ? 'enable' : 'disable'}`, { id: row.id }); - this.$toast.open(response.data.message); + this.$toast.open(response.message); } catch (error) { this.$onPromiseError(error); } }, async changeIsAdmin(row) { try { - const response = await this.axios.post(`${this.config.baseURL}/admin/users/${row.isAdmin ? 'promote' : 'demote'}`, { + const response = await this.$axios.$post(`admin/users/${row.isAdmin ? 'promote' : 'demote'}`, { id: row.id }); - this.$toast.open(response.data.message); + this.$toast.open(response.message); } catch (error) { this.$onPromiseError(error); } @@ -261,10 +262,10 @@ export default { }, async purgeFiles(row) { try { - const response = await this.axios.post(`${this.config.baseURL}/admin/users/purge`, { + const response = await this.$axios.$post(`admin/users/purge`, { id: row.id }); - this.$toast.open(response.data.message); + this.$toast.open(response.message); } catch (error) { this.$onPromiseError(error); } |