From 4410f2e46cbf961f2100038b53426bd07aebc4e9 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 19 Mar 2021 15:51:04 +0100 Subject: feat: get all commits --- src/store.js | 15 +++++++++++++++ src/views/Home.vue | 10 ++++++++++ 2 files changed, 25 insertions(+) (limited to 'src') 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: { } diff --git a/src/views/Home.vue b/src/views/Home.vue index 55c3c08..28da86b 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,6 +1,8 @@ -- cgit v1.2.3-18-g5258