aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/actions.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/js/actions.js')
-rw-r--r--web/src/js/actions.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/web/src/js/actions.js b/web/src/js/actions.js
index 2f247979..5c6f0167 100644
--- a/web/src/js/actions.js
+++ b/web/src/js/actions.js
@@ -1,6 +1,7 @@
import $ from "jquery";
import _ from "lodash";
import {AppDispatcher} from "./dispatcher.js";
+import {getCookie} from "./utils.js";
export var ActionTypes = {
// Connection
@@ -119,10 +120,18 @@ export var FlowActions = {
$.post("/clear");
},
download: () => window.location = "/flows/dump",
+
upload: (file) => {
+ var xsrf = $.param({_xsrf: getCookie("_xsrf")});
+ //console.log(xsrf);
var filereader = new FileReader();
filereader.file = file;
- filereader.onload = (e) => {$.post("/flows/dump", e.target.result); e.preventDefault();};
+ filereader.onload = (e) => {
+ fetch("/flows/dump?"+xsrf, {
+ method: 'post',
+ body: e.currentTarget.result
+ })
+ };
filereader.readAsBinaryString(file);
}
};