From dfbb563b6f78c35a6e8f8fda8a374b83d9a1af45 Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Wed, 13 Nov 2019 21:04:49 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Added=20payload=20upload=20feature.?= =?UTF-8?q?=20Fixes=20#298?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/styles.scss | 1 + pages/index.vue | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/assets/css/styles.scss b/assets/css/styles.scss index 5e374d5bc..831a86e0e 100644 --- a/assets/css/styles.scss +++ b/assets/css/styles.scss @@ -760,6 +760,7 @@ div.tab { order: 1; } +input[type="file"], input[type="radio"], div.tab { display: none; diff --git a/pages/index.vue b/pages/index.vue index 5fc3e3500..11c0075c2 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -116,11 +116,21 @@
@@ -1903,6 +1913,25 @@ export default { this.contentType = ["POST", "PUT", "PATCH"].includes(this.method) ? "application/json" : ""; + }, + uploadPayload() { + this.rawInput = true; + let file = this.$refs.payload.files[0]; + if (file != null) { + let reader = new FileReader(); + reader.onload = (e) => { + this.rawParams = e.target.result; + }; + reader.readAsText(file); + this.$toast.info("File imported", { + icon: "attach_file" + }); + } + else { + this.$toast.error("Choose a file", { + icon: "attach_file" + }); + } } }, mounted() {