diff client/src/store/imports.js @ 1711:aec17976528e

feat: scheduled import loaded from backend
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 08 Jan 2019 14:51:36 +0100
parents 8ff8d873ef6b
children 1b25e7a3a92e
line wrap: on
line diff
--- a/client/src/store/imports.js	Tue Jan 08 14:20:32 2019 +0100
+++ b/client/src/store/imports.js	Tue Jan 08 14:51:36 2019 +0100
@@ -22,6 +22,10 @@
   REJECTED: "declined"
 };
 
+const IMPORTTYPES = {
+  BOTTLENECK: "bottleneck"
+};
+
 const SCHEDULES = {
   DAILY: "daily",
   MONTHLY: "monthly"
@@ -82,6 +86,20 @@
     }
   },
   actions: {
+    getSchedules({ commit }) {
+      return new Promise((resolve, reject) => {
+        HTTP.get("/imports/config", {
+          headers: { "X-Gemma-Auth": localStorage.getItem("token") }
+        })
+          .then(response => {
+            commit("setSchedules", response.data);
+            resolve(response);
+          })
+          .catch(error => {
+            reject(error);
+          });
+      });
+    },
     triggerImport({ commit }, { type, data }) {
       return new Promise((resolve, reject) => {
         HTTP.post("imports/" + type, data, {
@@ -128,4 +146,4 @@
   }
 };
 
-export { imports, STATES, SCHEDULES };
+export { imports, STATES, SCHEDULES, IMPORTTYPES };