Adding placeholder and making sure query urls have a protocol.

This commit is contained in:
mike12345567 2021-12-09 10:02:47 +00:00
parent 4dd8dbc253
commit e1ae7c603d
2 changed files with 5 additions and 5 deletions

View File

@ -176,7 +176,7 @@
/> />
</div> </div>
<div class="url"> <div class="url">
<Input bind:value={url} /> <Input bind:value={url} placeholder="http://www.api.com/endpoint" />
</div> </div>
<Button cta disabled={!url} on:click={runQuery}>Send</Button> <Button cta disabled={!url} on:click={runQuery}>Send</Button>
</div> </div>

View File

@ -146,11 +146,11 @@ module RestModule {
getUrl(path: string, queryString: string): string { getUrl(path: string, queryString: string): string {
const main = `${path}?${queryString}` const main = `${path}?${queryString}`
if (!this.config.url) { let complete = !this.config.url ? main : `${this.config.url}/${main}`
return main if (!complete.startsWith("http")) {
} else { complete = `http://${complete}`
return `${this.config.url}/${main}`
} }
return complete
} }
async _req(query: RestQuery) { async _req(query: RestQuery) {