Added regex to handle url parts
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
|
||||
<pw-section class="blue" :label="$t('request')" ref="request">
|
||||
<ul>
|
||||
<div>
|
||||
<li>
|
||||
<label for="method">{{ $t("method") }}</label>
|
||||
<span class="select-wrapper">
|
||||
@@ -179,6 +180,7 @@
|
||||
</v-popover>
|
||||
</span>
|
||||
</li>
|
||||
</div>
|
||||
<li>
|
||||
<label for="url">{{ $t("url") }}</label>
|
||||
<input
|
||||
@@ -187,29 +189,10 @@
|
||||
id="url"
|
||||
name="url"
|
||||
type="url"
|
||||
v-model="url"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
<label for="path">{{ $t("path") }}</label>
|
||||
<input
|
||||
@keyup.enter="isValidURL ? sendRequest() : null"
|
||||
id="path"
|
||||
name="path"
|
||||
v-model="path"
|
||||
@input="pathInputHandler"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
<label for="label">{{ $t("label") }}</label>
|
||||
<input
|
||||
id="label"
|
||||
name="label"
|
||||
type="text"
|
||||
v-model="label"
|
||||
:placeholder="$t('optional')"
|
||||
v-model="uri"
|
||||
/>
|
||||
</li>
|
||||
<div>
|
||||
<li>
|
||||
<label class="hide-on-small-screen" for="send"> </label>
|
||||
<button
|
||||
@@ -224,6 +207,19 @@
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="label">{{ $t("label") }}</label>
|
||||
<input
|
||||
id="label"
|
||||
name="label"
|
||||
type="text"
|
||||
v-model="label"
|
||||
:placeholder="$t('optional')"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
<div
|
||||
class="blue"
|
||||
@@ -1617,6 +1613,20 @@ export default {
|
||||
}
|
||||
},
|
||||
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: {
|
||||
get() {
|
||||
return this.$store.state.request.url;
|
||||
|
||||
Reference in New Issue
Block a user