From 8057603ee05fb5555d0ffad427dcb97f1d122050 Mon Sep 17 00:00:00 2001 From: Roger Tuan <11964962+arcataroger@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:12:57 -0700 Subject: [PATCH] Update serialize.ts - Fix body.type vs options.type --- packages/rest-client-utils/src/serialize.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rest-client-utils/src/serialize.ts b/packages/rest-client-utils/src/serialize.ts index 1604aad..fbd03ee 100644 --- a/packages/rest-client-utils/src/serialize.ts +++ b/packages/rest-client-utils/src/serialize.ts @@ -116,7 +116,7 @@ export function serializeRequestBody( return { data: { ...(id || options.id ? { id: id || options.id } : {}), - type: type || options.type, + type: options.type, // If a body.type is passed in, it should go in data.attributes. Only options.type should be here at the root. ...(Object.keys(attributes).length > 0 ? { attributes } : {}), ...(Object.keys(relationships).length > 0 ? { relationships } : {}), ...(meta ? { meta } : {}),