Improve handling of configs
This commit is contained in:
parent
e08e1a7b0d
commit
41e3e2d774
|
@ -11,14 +11,10 @@ class OIDCStore extends BudiStore<PublicOIDCConfig> {
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
const tenantId = get(auth).tenantId
|
const tenantId = get(auth).tenantId
|
||||||
const config = await API.getOIDCConfig(tenantId)
|
const configs = await API.getOIDCConfigs(tenantId)
|
||||||
if (Object.keys(config || {}).length) {
|
|
||||||
// Just use the first config for now.
|
// Just use the first config for now.
|
||||||
// We will be support multiple logins buttons later on.
|
// We will be support multiple logins buttons later on.
|
||||||
this.set(config[0])
|
this.set(configs[0] || {})
|
||||||
} else {
|
|
||||||
this.set({})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { BaseAPIClient } from "./types"
|
||||||
export interface ConfigEndpoints {
|
export interface ConfigEndpoints {
|
||||||
getConfig: (type: ConfigType) => Promise<FindConfigResponse>
|
getConfig: (type: ConfigType) => Promise<FindConfigResponse>
|
||||||
getTenantConfig: (tentantId: string) => Promise<GetPublicSettingsResponse>
|
getTenantConfig: (tentantId: string) => Promise<GetPublicSettingsResponse>
|
||||||
getOIDCConfig: (tenantId: string) => Promise<GetPublicOIDCConfigResponse>
|
getOIDCConfigs: (tenantId: string) => Promise<GetPublicOIDCConfigResponse>
|
||||||
getOIDCLogos: () => Promise<Config<OIDCLogosConfig>>
|
getOIDCLogos: () => Promise<Config<OIDCLogosConfig>>
|
||||||
saveConfig: (config: SaveConfigRequest) => Promise<SaveConfigResponse>
|
saveConfig: (config: SaveConfigRequest) => Promise<SaveConfigResponse>
|
||||||
deleteConfig: (id: string, rev: string) => Promise<DeleteConfigResponse>
|
deleteConfig: (id: string, rev: string) => Promise<DeleteConfigResponse>
|
||||||
|
@ -73,7 +73,7 @@ export const buildConfigEndpoints = (API: BaseAPIClient): ConfigEndpoints => ({
|
||||||
* Gets the OIDC config for a certain tenant.
|
* Gets the OIDC config for a certain tenant.
|
||||||
* @param tenantId the tenant ID to get the config for
|
* @param tenantId the tenant ID to get the config for
|
||||||
*/
|
*/
|
||||||
getOIDCConfig: async tenantId => {
|
getOIDCConfigs: async tenantId => {
|
||||||
return await API.get({
|
return await API.get({
|
||||||
url: `/api/global/configs/public/oidc?tenantId=${tenantId}`,
|
url: `/api/global/configs/public/oidc?tenantId=${tenantId}`,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue