@shopify/shop-minis-react
Version:
React component library for Shopify Shop Minis with Tailwind CSS v4 support (source-only, requires TypeScript)
33 lines (27 loc) • 824 B
text/typescript
import {useShopActionQuery} from '../../internal/reactQuery'
import {useShopActions} from '../../internal/useShopActions'
import {
DataHookOptionsBase,
DataHookReturnsBase,
BuyerAttributes,
} from '../../types'
export interface UseBuyerAttributesParams extends DataHookOptionsBase {}
export interface UseBuyerAttributesReturns extends DataHookReturnsBase {
buyerAttributes: BuyerAttributes | null
}
export const useBuyerAttributes = (
params?: UseBuyerAttributesParams
): UseBuyerAttributesReturns => {
const {skip, ...shopActionParams} = params || {}
const {getBuyerAttributes} = useShopActions()
const {data, ...rest} = useShopActionQuery(
['buyerAttributes', shopActionParams],
getBuyerAttributes,
shopActionParams,
{skip}
)
return {
...rest,
buyerAttributes: data,
}
}