aboutsummaryrefslogtreecommitdiff
path: root/src/site/store/admin.js
diff options
context:
space:
mode:
authorZephyrrus <[email protected]>2021-06-17 01:13:15 +0300
committerZephyrrus <[email protected]>2021-06-17 01:13:15 +0300
commit6fe5055e9d62a6ae06128bf61a55960537e02091 (patch)
tree95f6ff2d4120aff6cdc83f57a0244663ef982811 /src/site/store/admin.js
parentfeat: fetch all settings if admin (diff)
downloadhost.fuwn.me-6fe5055e9d62a6ae06128bf61a55960537e02091.tar.xz
host.fuwn.me-6fe5055e9d62a6ae06128bf61a55960537e02091.zip
feat: show setting values on the settings page and implement sending to backend (no saving yet)
Diffstat (limited to 'src/site/store/admin.js')
-rw-r--r--src/site/store/admin.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/site/store/admin.js b/src/site/store/admin.js
index 9399345..0f946e9 100644
--- a/src/site/store/admin.js
+++ b/src/site/store/admin.js
@@ -26,6 +26,12 @@ export const actions = {
return response;
},
+ async saveSettings({ commit }, settings) {
+ const response = await this.$axios.$post('service/config', { settings });
+ commit('setSettings', response);
+
+ return response;
+ },
async fetchStatistics({ commit }, category) {
const url = category ? `service/statistics/${category}` : 'service/statistics';
const response = await this.$axios.$get(url);
@@ -148,5 +154,12 @@ export const mutations = {
state.user.isAdmin = isAdmin;
}
}
+ },
+ populateSchemaWithValues({ settings, settingsSchema }) {
+ for (const [key, value] of Object.entries(settings)) {
+ if (settingsSchema.keys?.[key] !== undefined) {
+ settingsSchema.keys[key].value = value;
+ }
+ }
}
};