Skip to content

Commit

Permalink
change markdata object (#821)
Browse files Browse the repository at this point in the history
* change markdata object

* condition is an object

* rename variable for clarity
  • Loading branch information
jreddig authored May 2, 2023
1 parent d4c59c4 commit aaeece2
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions clientlibs/js/src/functions/markExperimentPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -22,25 +24,29 @@ export default async function markExperimentPoint(
target?: string,
clientError?: string
): Promise<Interfaces.IMarkExperimentPoint> {
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 {
Expand Down

0 comments on commit aaeece2

Please sign in to comment.