fix(nextjs): fix issues with server provider #92
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
createOrganizationfunction toOrganizationContextandOrganizationProviderinpackages/react/src/contexts/Organization. This enables users to create new organizations through the context. [1] [2] [3]CreateOrganizationcomponent inpackages/nextjs/src/client/components/presentation/CreateOrganization/CreateOrganization.tsxto use the newcreateOrganizationfunction from the organization context instead of a custom action. [1] [2]Refactoring server actions:
createOrganizationActiontocreateOrganizationand improved error handling usingAsgardeoAPIErrorinpackages/nextjs/src/server/actions/createOrganization.ts.switchOrganizationinpackages/nextjs/src/server/actions/switchOrganization.tsto refresh the page after switching organizations for updated session data.Integration Updates:
AsgardeoProviderin both client and server contexts (packages/nextjs/src/client/contexts/Asgardeo/AsgardeoProvider.tsxandpackages/nextjs/src/server/AsgardeoProvider.tsx) to include thecreateOrganizationfunction and other related properties. [1] [2]Error Handling Improvements:
AsgardeoRuntimeErrorchecks inCreateOrganizationto ensure thecreateOrganizationfunction is available in the context.createOrganizationandswitchOrganization, usingAsgardeoAPIErrorfor better debugging and clarity. [1] [2]Miscellaneous Changes:
.changeset/early-boxes-hide.md) to document the patch-level updates for@asgardeo/nextjsand@asgardeo/react.These updates streamline organization management workflows, improve error handling, and enhance the maintainability of the codebase.
Related Issues
@asgardeo/react&@asgardeo/nextjs#81Related PRs
Checklist
Security checks