UNPKG

@scayle/storefront-core

Version:

Collection of essential utilities to work with the Storefront API

7 lines (6 loc) 291 B
export const DEFAULT_RPC_HTTP_METHOD = "POST"; export function defineRpcHandler(handler, options) { const rpcType = handler.length === 1 ? "NoParam" : "WithParam"; const httpMethod = options?.method ?? DEFAULT_RPC_HTTP_METHOD; return Object.assign(handler, { rpcType, httpMethod }); }