Update Organization Name Component - PropelAuth Docs
Update Organization Name Component
PropelAuth's Update Organization Name component allows you to customize the flow around a user updating an organization's name in your app.
Update Organization Name
Installation
Install this component from our shadcn registry.
npx shadcn@latest add https://components.propelauth.com/r/update-organization-name.json
Reference APIs
These are the APIs that are used by the above component. You can use these APIs directly in your own code.
updateOrgSettings
Updates the settings for an organization.
Arguments
org_id: string - The ID of the org to be updated.name: string - The new name of the org.allow_users_to_join_by_domain: boolean - If a domain is set for the org, new users can join the org if their domain matches the org's domain.restrict_invites_by_domain: boolean - If a domain is set for the org, only allow users with that domain to join.require_2fa_by: date - If requiring 2FA for an org, the date you want to enforce it by.
Response Functions
The response object has a handle function that you can use to handle the response. These functions can be async, and you can return values from them.
success: Successful request.orgsNotEnabled: Organizations are not enabled in this project.orgNotFound: The provided orgId was not found.forbidden: The user does not have permission to edit the org.badRequest: Incorrect arguments given.unauthorized: The user is not logged in.unexpectedOrUnhandled: An unexpected error occurred.
Request
const { updateOrgSettings } = useAuthFrontendApis()
const response = await updateOrgSettings({
org_id: '1189c444-8a2d-4c41-8b4b-ae43ce79a492',
name: 'Acme Inc',
allow_users_to_join_by_domain: true,
restrict_invites_by_domain: true,
require_2fa_by: '2025-01-16T00:00:00.000Z',
})
response.handle({
success() {
console.log('Updated org settings successfully.')
},
badRequest(error) {
for (const [field, fieldErrorMessage] of Object.entries(error.user_facing_errors)) {
console.log('Error: "' + fieldErrorMessage + '" for field: "' + field + '"')
}
},
orgsNotEnabled(error) {
console.log('Org not enabled', error)
},
orgNotFound(error) {
console.log('Org not found', error)
},
forbidden(error) {
console.log('Forbidden', error)
},
unexpectedOrUnhandled(error) {
console.log('Unexpected or unhandled error', error)
},
})
Successful Response
{}