Skip to main content

useBranding()

You're reading Identity & Access Management 7.2.0. The newest release is 7.3.0, and Cloud has the newest features. Go to the newest release

useBranding() returns the branding preference of your organization, as fetched by the WSO2 Identity Server Nuxt SDK (@asgardeo/nuxt).

Overview​

The server fetches the branding preference while it renders each page, and <AsgardeoRoot> supplies it to useBranding(). When the user is acting in an organization, the server fetches that organization's branding. The module auto-imports useBranding().

note

Call useBranding() only in components that render inside <AsgardeoRoot>. Otherwise, it throws an error. When preferences.theme.inheritFromBranding is false, the server doesn't fetch the branding preference and brandingPreference is null.

Usage​

<script setup lang="ts">
const { brandingPreference, activeTheme } = useBranding();
</script>

<template>
<p v-if="brandingPreference">Active branding theme: {{ activeTheme }}</p>
</template>

API​

PropertyTypeDescription
brandingPreferenceReadonly<Ref<BrandingPreference | null>>The branding preference from WSO2 Identity Server.
themeReadonly<Ref<Theme | null>>The theme derived from the branding preference.
activeThemeReadonly<Ref<'light' | 'dark' | null>>The active theme of the branding preference.
isLoadingReadonly<Ref<boolean>>Whether the branding preference is loading.
errorReadonly<Ref<Error | null>>The error from loading the branding preference, if any.
fetchBranding()() => Promise<void>Fetches the latest branding preference through GET /api/auth/branding and updates brandingPreference.
refetch()() => Promise<void>Same as fetchBranding().

Was this page helpful?