diff --git a/components/collections/saveRequest.vue b/components/collections/saveRequest.vue
new file mode 100644
index 000000000..dcdaff3a2
--- /dev/null
+++ b/components/collections/saveRequest.vue
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
Add New Request
+
Edit Request
+
+
+ close
+
+
+
+
+
+
+
+
+ Add
+ Save
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/index.vue b/pages/index.vue
index 88a45dc04..586603505 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -1,5 +1,10 @@
+
@@ -70,6 +75,13 @@
{{ isHidden ? 'Show Code' : 'Hide Code' }}
+
+
+
+ share
+ Save
+
+
@@ -361,6 +373,7 @@
import toggle from "../components/toggle";
import modal from "../components/modal";
import collections from '../components/collections';
+ import saveRequest from '../components/collections/saveRequest';
import parseCurlCommand from '../assets/js/curlparser.js';
import hljs from 'highlight.js';
import 'highlight.js/styles/dracula.css';
@@ -424,6 +437,7 @@
history,
autocomplete,
collections,
+ saveRequest,
},
data() {
return {
@@ -474,7 +488,9 @@
'application/x-www-form-urlencoded',
'text/html',
'text/plain'
- ]
+ ],
+ showRequestModal: false,
+ request: {},
}
},
watch: {
@@ -533,6 +549,20 @@
selectedRequest (newValue, oldValue) {
if (!newValue) return;
this.url = newValue.url;
+ this.path = '/api/users';
+ this.method = newValue.method;
+ this.auth = 'None';
+ this.httpUser = '';
+ this.httpPassword = '';
+ // passwordFieldType: 'password',
+ // bearerToken: '',
+ // headers: [],
+ // params: [],
+ // bodyParams: [],
+ // rawParams: '',
+ // rawInput: false,
+ // contentType: 'application/json',
+ // requestType: 'JavaScript XHR',
},
},
computed: {
@@ -1092,6 +1122,29 @@
icon: 'clear_all'
});
},
+ saveRequest() {
+ this.request = {
+ url: this.url,
+ path: this.path,
+ method: this.method,
+ auth: this.auth,
+ httpUser: this.httpUser,
+ httpPassword: this.httpPassword,
+ passwordFieldType: this.passwordFieldType,
+ bearerToken: this.bearerToken,
+ headers: this.headers,
+ params: this.params,
+ bodyParams: this.bodyParams,
+ rawParams: this.rawParams,
+ rawInput: this.rawInput,
+ contentType: this.contentType,
+ requestType: this.requestType,
+ }
+ this.showRequestModal = true;
+ },
+ hideRequestModal() {
+ this.showRequestModal = false;
+ },
},
mounted() {
this.observeRequestButton();
diff --git a/store/postwoman.js b/store/postwoman.js
index d14e6cf9b..34d607bd9 100644
--- a/store/postwoman.js
+++ b/store/postwoman.js
@@ -106,8 +106,18 @@ export const mutations = {
},
addRequest (state, payload) {
- const { collectionIndex, folderIndex, request } = payload;
- state.collections[collectionIndex].folders[folderIndex].push(request);
+ const { request } = payload;
+ state.collections[request.collection].folders[request.folder].requests.push(request);
+ },
+
+ saveRequeest (state, payload) {
+ const { request } = payload;
+ state.collections[request.collection].folders[request.folder].requests[request.requestIndex] = request;
+ },
+
+ removeFolder (state, payload) {
+ const { request } = payload;
+ state.collections[collectionIndex].folders[request.folder].requests.splice(request.requestIndex, 1)
},
selectRequest (state, payload) {