diff options
| author | Pitu <[email protected]> | 2021-01-08 20:55:57 +0900 |
|---|---|---|
| committer | Pitu <[email protected]> | 2021-01-08 20:55:57 +0900 |
| commit | 523359ec32e3fc8a8ede1fd394d73ec311979583 (patch) | |
| tree | b4fa578b1ab461694d2205dc85e9270664444d0e /src/site/store | |
| parent | chore: force migration on service start (diff) | |
| download | host.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.js | 15 |
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; |