UNPKG

@scayle/storefront-nuxt

Version:

Nuxt integration for the SCAYLE Commerce Engine and Storefront API

18 lines (17 loc) 455 B
import { defineRpcHandler, DEFAULT_RPC_HTTP_METHOD } from "@scayle/storefront-core"; export const normalizeRpcHandler = (handler) => { if (!handler) { return handler; } let normalized = handler; if (!("rpcType" in handler)) { normalized = defineRpcHandler(handler); } if (!("httpMethod" in normalized) || !normalized.httpMethod) { Object.assign(normalized, { httpMethod: DEFAULT_RPC_HTTP_METHOD }); } return normalized; };