UNPKG

@shopify/admin-api-client

Version:

Shopify Admin API Client - A lightweight JS client to interact with Shopify's Admin API

24 lines (20 loc) 667 B
import {CLIENT} from './constants'; export function validateRequiredStoreDomain(storeDomain: string | undefined) { if ( !storeDomain || typeof storeDomain !== 'string' || storeDomain.trim().length < 1 ) { throw new Error(`${CLIENT}: a valid store domain must be provided`); } } export function validateRequiredAccessToken(accessToken: string) { if (!accessToken) { throw new Error(`${CLIENT}: an access token must be provided`); } } export function validateServerSideUsage(isTesting = false) { if (typeof window !== 'undefined' && !isTesting) { throw new Error(`${CLIENT}: this client should not be used in the browser`); } }