aboutsummaryrefslogtreecommitdiff
path: root/src/site/store
diff options
context:
space:
mode:
authorPitu <[email protected]>2021-01-08 20:55:57 +0900
committerPitu <[email protected]>2021-01-08 20:55:57 +0900
commit523359ec32e3fc8a8ede1fd394d73ec311979583 (patch)
treeb4fa578b1ab461694d2205dc85e9270664444d0e /src/site/store
parentchore: force migration on service start (diff)
downloadhost.fuwn.me-523359ec32e3fc8a8ede1fd394d73ec311979583.tar.xz
host.fuwn.me-523359ec32e3fc8a8ede1fd394d73ec311979583.zip
chore: be able to refresh stats on demand
Diffstat (limited to 'src/site/store')
-rw-r--r--src/site/store/admin.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/site/store/admin.js b/src/site/store/admin.js
index b2d1926..0d0360b 100644
--- a/src/site/store/admin.js
+++ b/src/site/store/admin.js
@@ -22,9 +22,10 @@ export const actions = {
return response;
},
- async fetchStatistics({ commit }) {
- const response = await this.$axios.$get('service/statistics');
- commit('setStatistics', response);
+ async fetchStatistics({ commit }, category) {
+ const url = category ? `service/statistics/${category}` : 'service/statistics';
+ const response = await this.$axios.$get(url);
+ commit('setStatistics', { statistics: response.statistics, category: category });
return response;
},
@@ -96,8 +97,12 @@ export const mutations = {
setSettings(state, { config }) {
state.settings = config;
},
- setStatistics(state, { statistics }) {
- state.statistics = statistics;
+ setStatistics(state, { statistics, category }) {
+ if (category) {
+ state.statistics[category] = statistics[category];
+ } else {
+ state.statistics = statistics;
+ }
},
setUsers(state, { users }) {
state.users = users;