Delete User Account Component - PropelAuth Docs

Delete User Account Component

PropelAuth's Delete User Account component allows you to customize the flow around a user deleting their account in your app.


Delete Account


Shadcn Installation

Install this component from our shadcn registry.

npx shadcn@latest add https://components.propelauth.com/r/delete-user-account.json

Reference APIs

These are the APIs that are used by the above component. You can use these APIs directly in your own code.

deleteAccount

Deletes the logged in user's account from your application.

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.

Request

const { deleteAccount } = useAuthFrontendApis()

const response = await deleteAccount()
await response.handle({
    success: async () => {
        console.log('Account deleted')
    },
    actionDisabled(error) {
        console.log('Cannot delete account', error.user_facing_error)
    },
    unexpectedOrUnhandled(error) {
        console.log('Unexpected or unhandled error', error.user_facing_error)
    },
})

Successful Response

{}