summaryrefslogtreecommitdiff
path: root/store
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-10-16 19:30:29 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-10-16 19:30:29 +0200
commitc43aa314a3916be3c264d0d4f94f9153151d118f (patch)
tree094d643e67a495275c90f7b4e92a082687241343 /store
parent51143de16c323072c83f1968dfe31e2cf530d06c (diff)
Delete rows from admin cp
Diffstat (limited to 'store')
-rw-r--r--store/warnings.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/store/warnings.js b/store/warnings.js
index 65f1c92..d2983bd 100644
--- a/store/warnings.js
+++ b/store/warnings.js
@@ -126,4 +126,29 @@ export const actions = {
return res;
},
+ // Delete a warning
+ async deleteWarning({ commit, rootGetters }, id) {
+ commit("loadingStatus", true, { root: true });
+ let res = { status: 0, data: null };
+ let api = this.$config.api;
+
+ await fetch(`${api}/v1/warnings/${id}`, {
+ method: "DELETE",
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `Bearer ${rootGetters["auth/accessToken"]}`,
+ },
+ })
+ .then(async (response) => {
+ res.status = response.status;
+ res.data = await response.text();
+ })
+ .catch((e) => {
+ res.status = e.status;
+ });
+
+ commit("loadingStatus", false, { root: true });
+
+ return res;
+ },
};