Added regex to handle url parts

This commit is contained in:
Jacob Anavisca
2020-02-25 01:35:15 -05:00
parent 711cabcf9b
commit 8cc7b525d9
2 changed files with 2970 additions and 11 deletions

View File

@@ -182,19 +182,27 @@
id="url" id="url"
name="url" name="url"
type="url" type="url"
v-model="url" v-model="uri"
/> />
</li> </li>
<div>
<li> <li>
<label for="path">{{ $t("path") }}</label> <label class="hide-on-small-screen" for="send">&nbsp;</label>
<input <button
@keyup.enter="isValidURL ? sendRequest() : null" :disabled="!isValidURL"
id="path" @click="sendRequest"
name="path" id="send"
v-model="path" ref="sendButton"
@input="pathInputHandler" >
/> {{ $t("send") }}
<span>
<i class="material-icons">send</i>
</span>
</button>
</li> </li>
</div>
</ul>
<ul>
<li> <li>
<label for="label">{{ $t("label") }}</label> <label for="label">{{ $t("label") }}</label>
<input <input
@@ -1533,6 +1541,20 @@ export default {
}, },
}, },
computed: { computed: {
uri: {
get() {
return this.url + this.path;
},
set(value) {
let uriRegex = value.match(
/^((http[s]?:\/\/)?(<<[^\/]+>>)?[^\/]*|)(\/?.*)$/
);
let url = uriRegex[1];
let path = uriRegex[4];
this.url = url;
this.path = path;
}
},
url: { url: {
get() { get() {
return this.$store.state.request.url return this.$store.state.request.url

2937
pages/index.vue.orig Normal file

File diff suppressed because it is too large Load Diff