From aaeece2a5f1b1bd9be1c6ccc58d7d9a6333e07ae Mon Sep 17 00:00:00 2001 From: jreddig <97543136+jreddig@users.noreply.github.com> Date: Tue, 2 May 2023 12:00:03 -0400 Subject: [PATCH] change markdata object (#821) * change markdata object * condition is an object * rename variable for clarity --- .../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 {