UNPKG

@shopify/shop-minis-react

Version:

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

29 lines (25 loc) 791 B
import {useHandleAction} from '../../internal/useHandleAction' import {useShopActions} from '../../internal/useShopActions' import {SetSecretParams} from '../../types' interface UseSecureStorageReturns { /** * Get the secret from the secure storage. */ getSecret: () => Promise<string | null> /** * Set a secret in the secure storage. */ setSecret: (params: SetSecretParams) => Promise<void> /** * Remove the secret from the secure storage. */ removeSecret: () => Promise<void> } export function useSecureStorage(): UseSecureStorageReturns { const {getSecret, setSecret, removeSecret} = useShopActions() return { getSecret: useHandleAction(getSecret), setSecret: useHandleAction(setSecret), removeSecret: useHandleAction(removeSecret), } }