From ea3e503d13b7be477c064b02b9b2e5a9ef06c9a9 Mon Sep 17 00:00:00 2001
From: Pitu <heyitspitu@gmail.com>
Date: Fri, 29 Mar 2019 00:35:58 +0900
Subject: Added middleware for pages and switched to $axios

---
 src/site/pages/dashboard/settings.vue | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'src/site/pages/dashboard/settings.vue')

diff --git a/src/site/pages/dashboard/settings.vue b/src/site/pages/dashboard/settings.vue
index 02bf5d2..23635ed 100644
--- a/src/site/pages/dashboard/settings.vue
+++ b/src/site/pages/dashboard/settings.vue
@@ -132,6 +132,7 @@ export default {
 	components: {
 		Sidebar
 	},
+	middleware: 'auth',
 	data() {
 		return {
 			options: {}
@@ -151,8 +152,8 @@ export default {
 	methods: {
 		async getSettings() {
 			try {
-				const response = await this.axios.get(`${this.config.baseURL}/service/config`);
-				this.options = response.data.config;
+				const response = await this.$axios.$get(`service/config`);
+				this.options = response.config;
 				console.log(this.options);
 			} catch (error) {
 				this.$onPromiseError(error);
@@ -166,8 +167,8 @@ export default {
 		},
 		async restartService() {
 			try {
-				const response = await this.axios.post(`${this.config.baseURL}/service/restart`);
-				this.$toast.open(response.data.message);
+				const response = await this.$axios.$post(`service/restart`);
+				this.$toast.open(response.message);
 				return;
 			} catch (error) {
 				this.$onPromiseError(error);
-- 
cgit v1.2.3

