Delete Organization Component
PropelAuth's Delete Organization component allows you to customize the flow around a user deleting their organization in your app.
Delete Organization
Shadcn Installation
Install this component from our shadcn registry.
npx shadcn@latest add https://components.propelauth.com/r/delete-organization.json
Reference APIs
These are the APIs that are used by the above component. You can use these APIs directly in your own code.
deleteOrg
Deletes the provided organization.
Arguments
- Name
orgId*- Type
- string
- Description
- The ID of the org to be deleted.
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.
- Name
success- Description
- Successful request.
- Name
orgNotFound- Description
- The provided org does not exist.
- Name
actionDisabled- Description
- The 'Users can delete their own orgs' setting is disabled in your PropelAuth dashboard.
- Name
noDeletePermission- Description
- User does not have permission to delete the org.
- Name
unauthorized- Description
- The user is not logged in.
- Name
unexpectedOrUnhandled- Description
- An unexpected error occurred.
Request
const { deleteOrg } = useAuthFrontendApis()
const response = await deleteOrg('1189c444-8a2d-4c41-8b4b-ae43ce79a492')
response.handle({
success() {
console.log('Org deleted')
},
orgNotFound(error) {
console.log('Org not found', error.user_facing_error)
},
actionDisabled(error) {
console.log('Cannot delete org', error.user_facing_error)
},
noDeletePermission(error) {
console.log('No delete permission', error.user_facing_error)
},
unexpectedOrUnhandled(error) {
console.log('Unexpected or unhandled error', error.user_facing_error)
},
})Successful Response
{}