From 75ba8feef5a73d89cd6fb959fe6fba2f2f0f411d Mon Sep 17 00:00:00 2001 From: danoswaltCL <97542869+danoswaltCL@users.noreply.github.com> Date: Tue, 2 May 2023 13:01:09 -0400 Subject: [PATCH] change markdata object (#821) (#823) * change markdata object * condition is an object * rename variable for clarity Co-authored-by: jreddig <97543136+jreddig@users.noreply.github.com> --- .../js/src/functions/markExperimentPoint.ts | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/clientlibs/js/src/functions/markExperimentPoint.ts b/clientlibs/js/src/functions/markExperimentPoint.ts index f67c94fd21..4dc99f1ac6 100644 --- a/clientlibs/js/src/functions/markExperimentPoint.ts +++ b/clientlibs/js/src/functions/markExperimentPoint.ts @@ -3,11 +3,13 @@ import fetchDataService from '../common/fetchDataService'; import { MARKED_DECISION_POINT_STATUS } from 'upgrade_types'; interface markData { - site: string; - condition: string; userId: string; status: MARKED_DECISION_POINT_STATUS; - target?: string; + data: { + site: string; + assignedCondition: { conditionCode: string; experimentId?: string }, + target?: string; + } clientError?: string; } @@ -22,25 +24,29 @@ export default async function markExperimentPoint( target?: string, clientError?: string ): Promise { - let data: markData = { - site, - condition, + let requestBody: markData = { userId, status, + data: { + site: site, + assignedCondition: { + conditionCode: condition, + }, + } }; if (target) { - data = { - ...data, + requestBody.data = { + ...requestBody.data, target, }; } if (clientError) { - data = { - ...data, + requestBody = { + ...requestBody, clientError, }; } - const response = await fetchDataService(url, token, clientSessionId, data, Types.REQUEST_TYPES.POST); + const response = await fetchDataService(url, token, clientSessionId, requestBody, Types.REQUEST_TYPES.POST); if (response.status) { return response.data; } else {