CDP Frontend SDK
    Preparing search index...

    Function useEnforceUnauthenticated

    • Higher-order hook that wraps a callback with unauthenticated enforcement. This ensures that the wrapped function can only be called when the user is not signed in.

      Type Parameters

      • TArgs extends unknown[]

        Array type representing the arguments of the callback

      • TReturn

        Type representing the return value of the callback

      Parameters

      • callback: (...args: TArgs) => Promise<TReturn>

        The async function to wrap with authentication check

      Returns (...args: TArgs) => Promise<TReturn>

      A wrapped version of the callback that checks authentication

      Throws an error if the user is authenticated when the callback is invoked