summaryrefslogtreecommitdiff
path: root/src/store.js
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-03-24 21:26:51 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-03-24 21:26:51 +0100
commitc2ab16d3a89df2075f2e0047766168e8b711fe86 (patch)
treeb512ea64746c20eb0e1863c8eeb04398a2781e24 /src/store.js
parent57e1a9e33597f30da0870a9af4d3e9167a7b3367 (diff)
feat: add new repository
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 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);