UNPKG

@scayle/storefront-nuxt

Version:

Nuxt integration for the SCAYLE Commerce Engine and Storefront API

25 lines (24 loc) 1.61 kB
import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf, UseRpcCacheKey } from '../core/useRpc.js'; /** * Retrieves address data for a logged-in user using the `getShopUserAddresses` RPC method. * * This function acts as a wrapper around the `useRpc` composable, * simplifying the process of fetching data. It internally calls `useRpc` * with the provided options. * * @see https://scayle.dev/en/api-guides/customer-account-api/resources/customer/address/list-addresses * * @template DataT The type of the normalized RPC response data. Defaults to `NormalizedRpcResponse<'getShopUserAddresses'>`. * @template PickKeys The keys to pick from the data. Defaults to all keys of `DataT`. * @template DefaultT The default value to use if data is not available. Defaults to `null`. * * @param options An object containing options for the underlying `useRpc` call. * @param options.options The options for the underlying `useRpc` call, controlling data handling and loading state. * @param key A unique key for this RPC call. Used internally by `useRpc` for caching and state management. * * @returns The result of the `useRpc` call, which includes the fetched data, * loading state, and any error information. */ export declare function useUserAddresses<DataT = NormalizedRpcResponse<'getShopUserAddresses'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ options, }?: Partial<{ options: UseRpcOptions<'getShopUserAddresses', DataT, PickKeys, DefaultT>; }>, key?: UseRpcCacheKey): UseRpcReturn<'getShopUserAddresses', DataT, PickKeys, DefaultT>;