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 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/store.js') 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: { } -- cgit v1.2.3-18-g5258