diff --git a/assets/css/styles.scss b/assets/css/styles.scss
index f2b0cada2..4736154c9 100644
--- a/assets/css/styles.scss
+++ b/assets/css/styles.scss
@@ -95,7 +95,7 @@ button {
background-color: var(--bg-color);
color: var(--ac-color);
fill: var(--ac-color);
-
+
span {
margin-left: 8px;
}
@@ -375,11 +375,8 @@ fieldset#history {
margin: 4px;
textarea {
- width: 100%;
- }
-
- #response-details {
margin: 0;
+ width: 100%;
}
.covers-response {
diff --git a/components/history.vue b/components/history.vue
index fff9ed981..c13d041e4 100644
--- a/components/history.vue
+++ b/components/history.vue
@@ -29,13 +29,17 @@
@@ -268,7 +272,8 @@
},
data() {
return {
-
+ copyButton: '
',
+ copiedButton: '
',
method: 'GET',
url: 'https://reqres.in',
auth: 'None',
@@ -552,17 +557,20 @@
}
},
copyRequest() {
+ this.$refs.copyRequest.innerHTML = this.copiedButton + '
Copied';
var dummy = document.createElement('input');
document.body.appendChild(dummy);
dummy.value = window.location.href;
dummy.select();
document.execCommand('copy');
document.body.removeChild(dummy);
+ setTimeout(() => this.$refs.copyRequest.innerHTML = this.copyButton + '
Share URL', 1500)
},
copyResponse() {
- var copyText = document.getElementById("response-details");
- copyText.select();
+ this.$refs.copyResponse.innerHTML = this.copiedButton + '
Copied';
+ this.$refs.responseBody.select();
document.execCommand("copy");
+ setTimeout(() => this.$refs.copyResponse.innerHTML = this.copyButton + '
Copy', 1500)
},
togglePreview() {
this.previewEnabled = !this.previewEnabled;
@@ -593,8 +601,8 @@
}
let flats = ['method', 'url', 'path', 'auth', 'httpUser', 'httpPassword', 'bearerToken', 'contentType'].map(item => flat(item))
let deeps = ['headers', 'params'].map(item => deep(item))
- let bodyParams = this.rawInput ? [flat('rawParams')] : [deep('bodyParams')];
-
+ let bodyParams = this.rawInput ? [flat('rawParams')] : [deep('bodyParams')];
+
this.$router.replace('/?' + flats.concat(deeps, bodyParams).join('').slice(0, -1))
},
setRouteQueries(queries) {
@@ -604,8 +612,7 @@
if (key === 'rawParams') {
this.rawInput = true
this.rawParams = queries['rawParams']
- }
- else if (typeof(this[key]) === 'string') this[key] = queries[key]
+ } else if (typeof(this[key]) === 'string') this[key] = queries[key]
}
},
observeRequestButton() {