Skip to main content

<AsgardeoOrganizationList />

<AsgardeoOrganizationList> lists the organizations that the signed-in user belongs to, using the WSO2 Identity Platform Nuxt SDK (@asgardeo/nuxt).

Overview​

<AsgardeoOrganizationList> reads myOrganizations and switchOrganization() from useOrganization(). When the user selects an organization, the component emits select and then switches to that organization through POST /api/auth/organizations/switch.

After the switch, the SDK refreshes the organization data, the user profile and the authentication state on the page.

note

<AsgardeoOrganizationList> must render inside <AsgardeoRoot>. It needs preferences.user.fetchOrganizations to be true, which is the default.

Usage​

The component is auto-registered, so you don't need to import it.

Basic usage​

<script setup lang="ts">
const onSelect = (organization: { id: string; name: string }) => {
console.log('Switching to', organization.name);
};
</script>

<template>
<AsgardeoOrganizationList @select="onSelect" />
</template>

Custom UI​

<template>
<AsgardeoOrganizationList>
<template #default="{ organizations, isLoading }">
<p v-if="isLoading">Loading…</p>
<ul v-else>
<li v-for="org in organizations" :key="org.id">{{ org.name }}</li>
</ul>
</template>
</AsgardeoOrganizationList>
</template>

When you use the default slot, the list renders your content instead of the built-in list, and selecting an organization is up to you. Call useOrganization().switchOrganization() to switch.

Props​

PropTypeDefaultDescription
classNamestring''CSS class for the root element.

Slots​

SlotSlot propsDescription
default{ organizations, isLoading }Replaces the built-in list.

Events​

EventPayloadDescription
selectOrganizationEmitted when the user selects an organization, before the switch starts.

Was this page helpful?