aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPitu <[email protected]>2021-06-17 03:39:58 +0900
committerPitu <[email protected]>2021-06-17 03:39:58 +0900
commit30808a3574bec0c3c9c240833d2fa78715862422 (patch)
tree8354df223e4088e43b85a6764300d080866ee38d
parentfix: upload size (diff)
downloadhost.fuwn.me-30808a3574bec0c3c9c240833d2fa78715862422.tar.xz
host.fuwn.me-30808a3574bec0c3c9c240833d2fa78715862422.zip
feat: fetch all settings if admin
-rw-r--r--src/api/routes/service/configAllGET.js17
-rw-r--r--src/site/store/admin.js10
2 files changed, 27 insertions, 0 deletions
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;
},