summaryrefslogtreecommitdiff
path: root/store
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-09-26 18:21:28 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-09-26 18:21:28 +0200
commit53a32a36666d58b510d53ce2d78e7e2156c319aa (patch)
tree021795cd4c9b185c2cb4a4dc517b44c8c7c1d0a2 /store
parenta70c5c0a7164486568ffaec1e67a6e87de1bba93 (diff)
See reports (warnings on backend)
Diffstat (limited to 'store')
-rw-r--r--store/warnings.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/store/warnings.js b/store/warnings.js
index 07767ae..4c94459 100644
--- a/store/warnings.js
+++ b/store/warnings.js
@@ -15,6 +15,33 @@ export const mutations = {
};
export const actions = {
+ // Filter warnings
+ async filterWarnings({ commit, rootGetters }, payload) {
+ commit("loadingStatus", true, { root: true });
+ let res = { status: 0, data: null };
+ let api = this.$config.api;
+
+ await fetch(`${api}/v1/warnings/filter`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `Bearer ${rootGetters["auth/accessToken"]}`,
+ },
+ body: JSON.stringify(payload),
+ })
+ .then(async (response) => {
+ res.status = response.status;
+ const data = await response.json();
+ if (res.status == 200) {
+ commit("saveWarnings", data.results);
+ }
+ })
+ .catch((e) => {
+ res.status = e.status;
+ });
+
+ commit("loadingStatus", false, { root: true });
+ },
// Create a new warning
async createWarning({ commit, rootGetters }, payload) {
commit("loadingStatus", true, { root: true });