Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

499 B
Raw Blame
import { useLazySelector } from "embedding-sdk-package/hooks/private/use-lazy-selector";
import { getWindow } from "embedding-sdk-shared/lib/get-window";

/**
 * Returns the authentication status of the current user in the Metabase embedding SDK.
 * Returns `null` until the SDK is fully loaded and initialized.
 *
 * @function
 * @category useMetabaseAuthStatus
 */
export const useMetabaseAuthStatus = () =>
  useLazySelector(getWindow()?.METABASE_EMBEDDING_SDK_BUNDLE?.getLoginStatus) ??
  null;