Skip to content

Conversation

@brionmario
Copy link
Member

@brionmario brionmario commented Jul 5, 2025

Purpose

This pull request introduces several updates to improve organization management in the Asgardeo SDK. Key changes include adding support for creating organizations, enhancing error handling, and refactoring the organization-related server and client components. Below is a summary of the most important changes grouped by theme.

Organization Management Enhancements:

  • Support for creating organizations:

    • Added a createOrganization function to OrganizationContext and OrganizationProvider in packages/react/src/contexts/Organization. This enables users to create new organizations through the context. [1] [2] [3]
    • Updated the CreateOrganization component in packages/nextjs/src/client/components/presentation/CreateOrganization/CreateOrganization.tsx to use the new createOrganization function from the organization context instead of a custom action. [1] [2]
  • Refactoring server actions:

    • Renamed createOrganizationAction to createOrganization and improved error handling using AsgardeoAPIError in packages/nextjs/src/server/actions/createOrganization.ts.
    • Enhanced switchOrganization in packages/nextjs/src/server/actions/switchOrganization.ts to refresh the page after switching organizations for updated session data.

Integration Updates:

  • Context and provider adjustments:
    • Updated AsgardeoProvider in both client and server contexts (packages/nextjs/src/client/contexts/Asgardeo/AsgardeoProvider.tsx and packages/nextjs/src/server/AsgardeoProvider.tsx) to include the createOrganization function and other related properties. [1] [2]

Error Handling Improvements:

  • Runtime error handling:
    • Added AsgardeoRuntimeError checks in CreateOrganization to ensure the createOrganization function is available in the context.
    • Improved error reporting in server actions, such as createOrganization and switchOrganization, using AsgardeoAPIError for better debugging and clarity. [1] [2]

Miscellaneous Changes:

  • Changeset creation:
    • Added a changeset file (.changeset/early-boxes-hide.md) to document the patch-level updates for @asgardeo/nextjs and @asgardeo/react.

These updates streamline organization management workflows, improve error handling, and enhance the maintainability of the codebase.

Related Issues

Related PRs

  • N/A

Checklist

  • e2e cypress tests locally verified.
  • Manual test round performed and verified.
  • UX/UI review done on the final implementation.
  • Documentation provided. (Add links if there are any)
  • Unit tests provided. (Add links if there are any)
  • Integration tests provided. (Add links if there are any)

Security checks

@brionmario brionmario merged commit cd01943 into asgardeo:main Jul 5, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants