diff --git a/src/api/routes/service/configAllGET.js b/src/api/routes/service/configAllGET.js new file mode 100644 index 0000000..fe9dae6 --- /dev/null +++ b/src/api/routes/service/configAllGET.js @@ -0,0 +1,17 @@ +const Route = require('../../structures/Route'); +const Util = require('../../utils/Util'); + +class configGET extends Route { + constructor() { + super('/service/config/all', 'get', { adminOnly: true }); + } + + run(req, res) { + return res.json({ + message: 'Successfully retrieved config', + config: Util.config + }); + } +} + +module.exports = configGET; diff --git a/src/site/store/admin.js b/src/site/store/admin.js index 51213b7..9399345 100644 --- a/src/site/store/admin.js +++ b/src/site/store/admin.js @@ -11,6 +11,7 @@ export const state = () => ({ files: [] }, file: {}, + settings: {}, statistics: {}, settingsSchema: { type: null, @@ -19,6 +20,12 @@ export const state = () => ({ }); export const actions = { + async fetchSettings({ commit }) { + const response = await this.$axios.$get('service/config/all'); + commit('setSettings', response); + + return response; + }, async fetchStatistics({ commit }, category) { const url = category ? `service/statistics/${category}` : 'service/statistics'; const response = await this.$axios.$get(url); @@ -105,6 +112,9 @@ export const mutations = { state.statistics = statistics; } }, + setSettings(state, { config }) { + state.settings = config; + }, setSettingsSchema(state, { schema }) { state.settingsSchema = schema; },