UNPKG

@shopify/shop-minis-react

Version:

React component library for Shopify Shop Minis with Tailwind CSS v4 support (source-only, requires TypeScript)

38 lines (32 loc) 865 B
import {useShopActions} from '../../internal/useShopActions' import {useShopActionsDataFetching} from '../../internal/useShopActionsDataFetching' import { DataHookOptionsBase, DataHookReturnsBase, UserProfile, } from '../../types' export interface UseCurrentUserParams extends DataHookOptionsBase {} export interface UseCurrentUserReturns extends DataHookReturnsBase { currentUser: UserProfile | null } /** * Hook to fetch the current user's profile. */ export const useCurrentUser = ( params?: UseCurrentUserParams ): UseCurrentUserReturns => { const {skip, ...shopActionParams} = params || {} const {getCurrentUser} = useShopActions() const {data, ...rest} = useShopActionsDataFetching( getCurrentUser, shopActionParams, { skip, hook: 'useCurrentUser', } ) return { ...rest, currentUser: data, } }