summaryrefslogtreecommitdiff
path: root/src/store.js
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-03-19 15:51:04 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-03-19 15:51:04 +0100
commit4410f2e46cbf961f2100038b53426bd07aebc4e9 (patch)
tree59bb661b4b15d04555b434db41a4cb9560da0cdc /src/store.js
parenta686db800f50db4f6585fcdf1110873f577bfaeb (diff)
feat: get all commits
Diffstat (limited to 'src/store.js')
-rw-r--r--src/store.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/store.js b/src/store.js
index 0e96ac7..9080bd0 100644
--- a/src/store.js
+++ b/src/store.js
@@ -8,9 +8,24 @@ export default new Vuex.Store({
api: process.env.VUE_APP_BACKEND_URL,
commits: [],
},
+ get: {
+ commits: state => {
+ return state.commits
+ },
+ },
mutations: {
+ load_commits: (state, value) => {
+ state.commits = value
+ },
},
actions: {
+ // Get all commits from the api backend
+ async get_commits({commit}) {
+ await fetch(`${this.state.api}/commit/`)
+ .then(async response => {
+ commit('load_commits', await response.json());
+ })
+ },
},
modules: {
}