From 53a32a36666d58b510d53ce2d78e7e2156c319aa Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 26 Sep 2022 18:21:28 +0200 Subject: See reports (warnings on backend) --- store/warnings.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'store') 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 }); -- cgit v1.2.3-18-g5258