diff options
| author | Zephyrrus <[email protected]> | 2021-06-17 01:13:15 +0300 |
|---|---|---|
| committer | Zephyrrus <[email protected]> | 2021-06-17 01:13:15 +0300 |
| commit | 6fe5055e9d62a6ae06128bf61a55960537e02091 (patch) | |
| tree | 95f6ff2d4120aff6cdc83f57a0244663ef982811 /src/site/store/admin.js | |
| parent | feat: fetch all settings if admin (diff) | |
| download | host.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.js | 13 |
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; + } + } } }; |