Function useLogout

  • Returns a stateful asynchronous logout function.

    The Promise will resolve after successful logout.

    The Promise will reject otherwise.

    Example

    function LogoutButtonExample()
    {
    const logout = useLogout();

    // logout.loading is true once the logout function is called.
    // It resets to false after the function resolves or rejects.
    console.log(logout.loading);

    return <button
    disabled={login.loading}
    onClick={() => logout()}
    >
    log out
    </button>;
    }

    Returns

    Stateful asynchronous logout function.

    Parameters

    • logoutUrl: string | URL = '/api/unologin/logout'

      Optional logout URL.

    Returns CallbackWithState<((...args: []) => Promise<void>), {
        loading: boolean;
    }>

Generated using TypeDoc