Fix auth state
This commit is contained in:
parent
480042eda9
commit
49ef14237f
|
@ -59,7 +59,6 @@
|
||||||
requestBindings = {}
|
requestBindings = {}
|
||||||
let saveId
|
let saveId
|
||||||
let response, schema, enabledHeaders
|
let response, schema, enabledHeaders
|
||||||
let authConfigId
|
|
||||||
let dynamicVariables, addVariableModal, varBinding, globalDynamicBindings
|
let dynamicVariables, addVariableModal, varBinding, globalDynamicBindings
|
||||||
let restBindings = getRestBindings()
|
let restBindings = getRestBindings()
|
||||||
let nestedSchemaFields = {}
|
let nestedSchemaFields = {}
|
||||||
|
@ -170,7 +169,6 @@
|
||||||
|
|
||||||
newQuery.fields.path = url?.split("?")[0]
|
newQuery.fields.path = url?.split("?")[0]
|
||||||
newQuery.fields.queryString = queryString
|
newQuery.fields.queryString = queryString
|
||||||
newQuery.fields.authConfigId = authConfigId
|
|
||||||
newQuery.fields.disabledHeaders = restUtils.flipHeaderState(enabledHeaders)
|
newQuery.fields.disabledHeaders = restUtils.flipHeaderState(enabledHeaders)
|
||||||
newQuery.schema = schema || {}
|
newQuery.schema = schema || {}
|
||||||
newQuery.nestedSchemaFields = nestedSchemaFields || {}
|
newQuery.nestedSchemaFields = nestedSchemaFields || {}
|
||||||
|
@ -270,22 +268,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getAuthConfigId = () => {
|
|
||||||
let id = query.fields.authConfigId
|
|
||||||
if (id) {
|
|
||||||
// find the matching config on the datasource
|
|
||||||
const matchedConfig = datasource?.config?.authConfigs?.filter(
|
|
||||||
c => c._id === id
|
|
||||||
)[0]
|
|
||||||
// clear the id if the config is not found (deleted)
|
|
||||||
// i.e. just show 'None' in the dropdown
|
|
||||||
if (!matchedConfig) {
|
|
||||||
id = undefined
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
const buildAuthConfigs = datasource => {
|
const buildAuthConfigs = datasource => {
|
||||||
if (datasource?.config?.authConfigs) {
|
if (datasource?.config?.authConfigs) {
|
||||||
return datasource.config.authConfigs.map(c => ({
|
return datasource.config.authConfigs.map(c => ({
|
||||||
|
@ -441,7 +423,6 @@
|
||||||
query.fields.path = `${datasource.config.url}/${path ? path : ""}`
|
query.fields.path = `${datasource.config.url}/${path ? path : ""}`
|
||||||
}
|
}
|
||||||
requestBindings = restUtils.queryParametersToKeyValue(query.parameters)
|
requestBindings = restUtils.queryParametersToKeyValue(query.parameters)
|
||||||
authConfigId = getAuthConfigId()
|
|
||||||
if (!query.fields.disabledHeaders) {
|
if (!query.fields.disabledHeaders) {
|
||||||
query.fields.disabledHeaders = {}
|
query.fields.disabledHeaders = {}
|
||||||
}
|
}
|
||||||
|
@ -667,7 +648,7 @@
|
||||||
label="Auth"
|
label="Auth"
|
||||||
labelPosition="left"
|
labelPosition="left"
|
||||||
placeholder="None"
|
placeholder="None"
|
||||||
bind:value={authConfigId}
|
bind:value={query.fields.authConfigId}
|
||||||
options={authConfigs}
|
options={authConfigs}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue