diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-03-24 21:28:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-24 21:28:03 +0100 |
commit | e75b3fe8cc54f62d6c6dc6b3a0c98c2c7640017f (patch) | |
tree | a4d29f81306c519f21464c2d257a4e1f726db68a /src/store.js | |
parent | 7075b22bda0da70108f150208a8b8f0898854eb1 (diff) | |
parent | 298076829936818ad95e5a9de4b57c81158779d2 (diff) |
Merge pull request #13 from gico-net/feat/add-repo
Add repository if does not exists
Diffstat (limited to 'src/store.js')
-rw-r--r-- | src/store.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/store.js b/src/store.js index 1483402..51dfc91 100644 --- a/src/store.js +++ b/src/store.js @@ -134,6 +134,21 @@ export default new Vuex.Store({ async set_committer({commit}, avatar) { commit('load_committer_avatar', avatar); }, + // Add new repository + async add_repo({commit}, payload) { + commit('loading_state', true) + let res + await fetch(`${this.state.api}/repo/`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(payload), + }) + .then(async response => { + res = await response.json() + }) + commit('loading_state', false) + return res + }, // Set loading state async set_loading({commit}, status) { commit('loading_state', status); |