summaryrefslogtreecommitdiff
path: root/src/store.js
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-03-20 18:01:09 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-03-20 18:01:09 +0100
commit45e5a794ae423e81afa7fdde329f34e3d4a0bcd3 (patch)
tree1afd7082ca2570a54bd3ba0687542ba94996bbb4 /src/store.js
parenta9ece91610c7f33cbc6445b58cfd1a9b43a89a49 (diff)
feat: add top authors section
Diffstat (limited to 'src/store.js')
-rw-r--r--src/store.js23
1 files changed, 23 insertions, 0 deletions
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: {
}