diff --git a/webapp/src/services/api/studies/tableMode/index.ts b/webapp/src/services/api/studies/tableMode/index.ts index cd77a71891..c6c4db5b80 100644 --- a/webapp/src/services/api/studies/tableMode/index.ts +++ b/webapp/src/services/api/studies/tableMode/index.ts @@ -1,10 +1,10 @@ -import { snakeCase } from "lodash"; import { DeepPartial } from "react-hook-form"; import { StudyMetadata } from "../../../../common/types"; import client from "../../client"; import { format } from "../../../../utils/stringUtils"; import { TABLE_MODE_API_URL } from "../../constants"; import type { TableData, TableModeColumnsForType, TableModeType } from "./type"; +import { toColumnApiName } from "./utils"; export async function getTableMode( studyId: StudyMetadata["id"], @@ -15,7 +15,7 @@ export async function getTableMode( const res = await client.get(url, { params: { table_type: type, - columns: columns.map(snakeCase).join(","), + columns: columns.map(toColumnApiName).join(","), }, }); return res.data; diff --git a/webapp/src/services/api/studies/tableMode/utils.ts b/webapp/src/services/api/studies/tableMode/utils.ts new file mode 100644 index 0000000000..75a97e0e7d --- /dev/null +++ b/webapp/src/services/api/studies/tableMode/utils.ts @@ -0,0 +1,11 @@ +import { snakeCase } from "lodash"; +import { TableModeColumnsForType, TableModeType } from "./type"; + +export function toColumnApiName( + column: TableModeColumnsForType[number], +): string { + if (column === "co2") { + return "co2"; + } + return snakeCase(column); +}