summaryrefslogtreecommitdiff
path: root/store
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-10-17 22:52:28 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-10-17 22:52:28 +0200
commit1654dd1116d6341923510e02abedf3dd8a687679 (patch)
treea3dd4bce7b2d1614bfb6bff93b645d0844176395 /store
parent0791dec1fca3e9a0eb41486a29767a67fdb6533b (diff)
admin: edit warnings
Diffstat (limited to 'store')
-rw-r--r--store/warnings.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/store/warnings.js b/store/warnings.js
index d2983bd..30336d9 100644
--- a/store/warnings.js
+++ b/store/warnings.js
@@ -45,6 +45,30 @@ export const actions = {
commit("loadingStatus", false, { root: true });
},
+ // Find a warning by its id
+ async findWarning({ 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}`, {
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `Bearer ${rootGetters["auth/accessToken"]}`,
+ },
+ })
+ .then(async (response) => {
+ res.data = await response.json();
+ res.status = response.status;
+ })
+ .catch((e) => {
+ res.status = e.status;
+ });
+
+ commit("loadingStatus", false, { root: true });
+
+ return res;
+ },
// Filter warnings
async filterWarnings({ commit, rootGetters }, payload) {
commit("loadingStatus", true, { root: true });