From c169ab6dc1727c7ca5dd45fcaeb419b44cbf1908 Mon Sep 17 00:00:00 2001 From: Pitu Date: Thu, 28 Feb 2019 23:26:44 +0900 Subject: Some stuff --- src/site/pages/dashboard/settings.vue | 42 ++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 6 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 19b0c5b..a71358e 100644 --- a/src/site/pages/dashboard/settings.vue +++ b/src/site/pages/dashboard/settings.vue @@ -70,7 +70,7 @@ - @@ -93,7 +93,7 @@ - @@ -109,13 +109,15 @@ - - +
+ +
@@ -135,6 +137,11 @@ export default { options: {} }; }, + computed: { + config() { + return this.$store.state.config; + } + }, metaInfo() { return { title: 'Settings' }; }, @@ -144,10 +151,33 @@ export default { title: 'Settings', location: window.location.href }); + + this.getSettings(); }, methods: { + async getSettings() { + try { + const response = await this.axios.get(`${this.config.baseURL}/service/config`); + this.options = response.data.config; + console.log(this.options); + } catch (error) { + this.$onPromiseError(error); + } + }, + promptRestartService() { + this.$dialog.confirm({ + message: 'Keep in mind that restarting only works if you have PM2 or something similar set up. Continue?', + onConfirm: () => this.restartService() + }); + }, async restartService() { - // + try { + const response = await this.axios.post(`${this.config.baseURL}/service/restart`); + this.$toast.open(response.data.message); + return; + } catch (error) { + this.$onPromiseError(error); + } } } }; -- cgit v1.2.3