From 45e5a794ae423e81afa7fdde329f34e3d4a0bcd3 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Sat, 20 Mar 2021 18:01:09 +0100 Subject: feat: add top authors section --- src/store.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/store.js') diff --git a/src/store.js b/src/store.js index 2fd04eb..79bdaff 100644 --- a/src/store.js +++ b/src/store.js @@ -7,16 +7,24 @@ export default new Vuex.Store({ state: { api: process.env.VUE_APP_BACKEND_URL, loading: false, + loading_top_authors: false, commits: [], + top_authors: [], emails: {}, }, getters: { loading: state => { return state.loading }, + loading_top_authors: state => { + return state.loading_top_authors + }, commits: state => { return state.commits }, + top_authors: state => { + return state.top_authors + }, emails: state => { return state.emails }, @@ -25,9 +33,15 @@ export default new Vuex.Store({ loading_state: (state, value) => { state.loading = value }, + loading_top_authors_state: (state, value) => { + state.loading_top_authors = value + }, load_commits: (state, value) => { state.commits = value }, + load_top_authors: (state, value) => { + state.top_authors = value + }, load_emails: (state, value) => { state.emails = value }, @@ -56,6 +70,15 @@ export default new Vuex.Store({ commit('load_emails', emails_obj); }) }, + /// Get the ranking of commits authors + async get_top_authors({commit}) { + commit('loading_top_authors_state', true) + await fetch(`${this.state.api}/commit/top/`) + .then(async response => { + commit('load_top_authors', await response.json()); + }) + commit('loading_top_authors_state', false) + } }, modules: { } -- cgit v1.2.3-18-g5258