Skip to content

Commit

Permalink
fix: restrict data transformation to remote requests
Browse files Browse the repository at this point in the history
  • Loading branch information
MailineN committed Jul 2, 2024
1 parent 45b8000 commit a70dbed
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/service/api-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,14 @@ const requestPutSurveyData = (
data: SurveyData,
token?: string,
): Promise<SurveyData> => {
const lunaticData = transformCollectedArray(data.data?.COLLECTED);
console.log("requestPutSurveyData, with data: ", lunaticData);
const lunaticData = token ? transformCollectedArray(data.data?.COLLECTED) : data.data?.COLLECTED;
if (token) {
console.log("lunaticData has been converted");
}
const surveyData: SurveyData = {
data: lunaticData,
stateData: data.stateData,
};
console.log("requestPutSurveyData, with data: ", surveyData);
return new Promise(resolve => {
axios
.put(
Expand Down Expand Up @@ -264,7 +265,10 @@ const requestPutDataReviewer = (
data: LunaticData,
token?: string,
): Promise<LunaticData> => {
const lunaticData: LunaticData = transformCollectedArray(data?.COLLECTED);
const lunaticData: LunaticData = token ? transformCollectedArray(data?.COLLECTED) : data?.COLLECTED;
if (token) {
console.log("lunaticData has been converted");
}
return new Promise<LunaticData>(resolve => {
axios
.put(
Expand Down

0 comments on commit a70dbed

Please sign in to comment.