Fix auth state
This commit is contained in:
parent
480042eda9
commit
49ef14237f
|
@ -59,7 +59,6 @@
|
|||
requestBindings = {}
|
||||
let saveId
|
||||
let response, schema, enabledHeaders
|
||||
let authConfigId
|
||||
let dynamicVariables, addVariableModal, varBinding, globalDynamicBindings
|
||||
let restBindings = getRestBindings()
|
||||
let nestedSchemaFields = {}
|
||||
|
@ -170,7 +169,6 @@
|
|||
|
||||
newQuery.fields.path = url?.split("?")[0]
|
||||
newQuery.fields.queryString = queryString
|
||||
newQuery.fields.authConfigId = authConfigId
|
||||
newQuery.fields.disabledHeaders = restUtils.flipHeaderState(enabledHeaders)
|
||||
newQuery.schema = schema || {}
|
||||
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 => {
|
||||
if (datasource?.config?.authConfigs) {
|
||||
return datasource.config.authConfigs.map(c => ({
|
||||
|
@ -441,7 +423,6 @@
|
|||
query.fields.path = `${datasource.config.url}/${path ? path : ""}`
|
||||
}
|
||||
requestBindings = restUtils.queryParametersToKeyValue(query.parameters)
|
||||
authConfigId = getAuthConfigId()
|
||||
if (!query.fields.disabledHeaders) {
|
||||
query.fields.disabledHeaders = {}
|
||||
}
|
||||
|
@ -667,7 +648,7 @@
|
|||
label="Auth"
|
||||
labelPosition="left"
|
||||
placeholder="None"
|
||||
bind:value={authConfigId}
|
||||
bind:value={query.fields.authConfigId}
|
||||
options={authConfigs}
|
||||
/>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue