Changing reactivity a bit to make it a bit more understandable.

This commit is contained in:
mike12345567 2021-12-02 11:38:42 +00:00
parent 4de2d55112
commit 57169bc910
1 changed files with 6 additions and 9 deletions

View File

@ -27,6 +27,7 @@
$: integrationInfo = $integrations[datasourceType]
$: queryConfig = integrationInfo?.query
$: url = buildUrl(url, breakQs)
$: checkQueryName(url)
function getSelectedQuery() {
return (
@ -68,15 +69,14 @@
return str
}
function checkQueryName(queryToCheck, inputUrl = null) {
if (queryToCheck && (!queryToCheck.name || queryToCheck.flags.urlName)) {
queryToCheck.flags.urlName = true
queryToCheck.name = url || inputUrl
function checkQueryName(inputUrl = null) {
if (query && (!query.name || query.flags.urlName)) {
query.flags.urlName = true
query.name = url || inputUrl
}
}
function buildUrl(base, qsObj) {
console.log(base)
if (!base) {
return base
}
@ -130,10 +130,7 @@
/>
</div>
<div class="url">
<Input
bind:value={url}
on:change={({ detail }) => checkQueryName(query, detail)}
/>
<Input bind:value={url} />
</div>
<Button cta disabled={!url} on:click={saveQuery}>Send</Button>
</div>