Skip to content

useSignOut

Handles signing out the user and disconnecting the wallet session.

Use cases:
  • Log out the user and clear wallet/account state.
Returns:
  • signOut: Function to sign out.
  • Status flags: isLoading, isError, isSuccess.
import { useSignOut } from "@openfort/react"
 
function SampleComponent() {
  const {
    isLoading, // Indicates if the hook is currently loading.
    isError, // Indicates if the hook has encountered an error.
    isSuccess, // Indicates if the hook has successfully completed.
    error, // The error object if an error occurred, otherwise null.
    signOut, // Sign out the current user.
  } = useSignOut({
    throwOnError, // Whether to throw errors.
    onSuccess, // Callback function to execute on success.
    onError, // Callback function to execute on error.
    onSettled, // Callback function to execute when the operation is settled (either success or error).
  })
  // ...
}