use api response as a mount check
This commit is contained in:
parent
4821ce1e8c
commit
d19f95f2ec
|
@ -85,6 +85,7 @@ describe("AISettings", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should display the 'Enable BB AI' button", async () => {
|
it("should display the 'Enable BB AI' button", async () => {
|
||||||
|
API.getConfig.mockResolvedValueOnce({ config: {} })
|
||||||
setupDOM()
|
setupDOM()
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
const enableButton = instance.getByText("Enable BB AI")
|
const enableButton = instance.getByText("Enable BB AI")
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
let mounted = false
|
|
||||||
let aiConfig: AIConfig
|
let aiConfig: AIConfig
|
||||||
let configModal: { show: () => void; hide: () => void }
|
let configModal: { show: () => void; hide: () => void }
|
||||||
let portalModal: { show: () => void; hide: () => void }
|
let portalModal: { show: () => void; hide: () => void }
|
||||||
|
@ -154,14 +153,13 @@
|
||||||
aiConfig = (await API.getConfig(ConfigType.AI)) as AIConfig
|
aiConfig = (await API.getConfig(ConfigType.AI)) as AIConfig
|
||||||
const licenseKeyResponse = await API.getLicenseKey()
|
const licenseKeyResponse = await API.getLicenseKey()
|
||||||
hasLicenseKey = licenseKeyResponse?.licenseKey
|
hasLicenseKey = licenseKeyResponse?.licenseKey
|
||||||
mounted = true
|
|
||||||
} catch {
|
} catch {
|
||||||
notifications.error("Error fetching AI settings")
|
notifications.error("Error fetching AI settings")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if mounted}
|
{#if aiConfig}
|
||||||
<Layout noPadding>
|
<Layout noPadding>
|
||||||
<Layout gap="XS" noPadding>
|
<Layout gap="XS" noPadding>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
|
Loading…
Reference in New Issue