1
0
Fork 0
mirror of synced 2024-09-09 14:11:30 +12:00

Display api key

This commit is contained in:
adrinr 2023-03-21 16:46:05 +00:00
parent 9094d3c9fd
commit 2fb6f81094

View file

@ -13,11 +13,12 @@
} from "@budibase/bbui" } from "@budibase/bbui"
import { onMount } from "svelte" import { onMount } from "svelte"
import { API } from "api" import { API } from "api"
import { organisation } from "stores/portal" import { organisation, auth } from "stores/portal"
const configType = "scim" const configType = "scim"
$: scimEnabled = true $: scimEnabled = true
$: apiKey = null
async function saveConfig(config) { async function saveConfig(config) {
// Delete unsupported fields // Delete unsupported fields
@ -39,7 +40,7 @@
} }
} }
onMount(async () => { async function fetchConfig() {
try { try {
const scimConfig = await API.getConfig(configType) const scimConfig = await API.getConfig(configType)
scimEnabled = scimConfig?.enabled scimEnabled = scimConfig?.enabled
@ -47,6 +48,18 @@
console.error(error) console.error(error)
notifications.error("Error fetching SCIM config") notifications.error("Error fetching SCIM config")
} }
}
async function fetchAPIKey() {
try {
apiKey = await auth.fetchAPIKey()
} catch (err) {
notifications.error("Unable to fetch API key")
}
}
onMount(async () => {
await Promise.all(fetchConfig(), fetchAPIKey())
}) })
const copyToClipboard = async value => { const copyToClipboard = async value => {
@ -54,12 +67,12 @@
notifications.success("Copied") notifications.success("Copied")
} }
const settings = [ $: settings = [
{ {
title: "Provisioning URL", title: "Provisioning URL",
value: `${$organisation.platformUrl}/api/global/scim/v2`, value: `${$organisation.platformUrl}/api/global/scim/v2`,
}, },
{ title: "Provisioning Token", value: "token" }, { title: "Provisioning Token", value: apiKey },
] ]
</script> </script>