Skip to main content

Overview

useSignOut hook is used to handle the sign-out process. It leverages the react-query library to manage the asynchronous operation and provides error handling.

Example Usage

sign-out-component.tsx
import { useSignOut } from '@locai1/iam-react';

const Header = () => {
  const { signOut, error } = useSignOut();

  const handleSignOut = () => {
    signOut();
  };

  return (
    <header>
      <button onClick={handleSignOut} disabled={isLoading}>
        Sign Out
      </button>
      {error && <div>{error.message}</div>}
    </header>
  );
};

Returns

signOut
() => void
function that triggers the sign-out process.
isLoading
boolean
boolean indicating whether the sign-out process is currently in progress.
isError
boolean
boolean indicating whether an error occurred during the sign-out process.
error
HttpError | Error
error object if an error occurred during the sign-out process.