Merge branch 'refactor/ui' of https://github.com/hoppscotch/hoppscotch into refactor/ui

This commit is contained in:
liyasthomas
2021-07-30 13:15:10 +05:30
9 changed files with 358 additions and 126 deletions

View File

@@ -1546,59 +1546,6 @@ export default defineComponent({
},
async mounted() {
restRequest$.subscribe((x) => console.log(x))
this._keyListener = function (e) {
if (e.key === "g" && (e.ctrlKey || e.metaKey)) {
e.preventDefault()
if (!this.runningRequest) {
this.sendRequest()
} else {
this.cancelRequest()
}
}
if (e.key === "s" && (e.ctrlKey || e.metaKey)) {
e.preventDefault()
this.saveRequest()
}
if (e.key === "k" && (e.ctrlKey || e.metaKey)) {
e.preventDefault()
this.copyRequest()
}
if (e.key === "i" && (e.ctrlKey || e.metaKey)) {
e.preventDefault()
this.$refs.clearAll.click()
}
if ((e.key === "g" || e.key === "G") && e.altKey) {
this.method = "GET"
}
if ((e.key === "h" || e.key === "H") && e.altKey) {
this.method = "HEAD"
}
if ((e.key === "p" || e.key === "P") && e.altKey) {
this.method = "POST"
}
if ((e.key === "u" || e.key === "U") && e.altKey) {
this.method = "PUT"
}
if ((e.key === "x" || e.key === "X") && e.altKey) {
this.method = "DELETE"
}
if (e.key == "ArrowUp" && e.altKey && this.currentMethodIndex > 0) {
this.method =
this.methodMenuItems[
--this.currentMethodIndex % this.methodMenuItems.length
]
} else if (
e.key == "ArrowDown" &&
e.altKey &&
this.currentMethodIndex < 9
) {
this.method =
this.methodMenuItems[
++this.currentMethodIndex % this.methodMenuItems.length
]
}
}
document.addEventListener("keydown", this._keyListener.bind(this))
await this.oauthRedirectReq()
},
created() {
@@ -1625,8 +1572,5 @@ export default defineComponent({
}
)
},
beforeDestroy() {
document.removeEventListener("keydown", this._keyListener)
},
})
</script>