Skip to content

Commit cc2cdc4

Browse files
committed
fix: incorrect serialization of upload data
1 parent 9c26763 commit cc2cdc4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

apps/web/src/features/upload/hooks/useUploadInstrumentRecords.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ export function useUploadInstrumentRecords() {
99
const addNotification = useNotificationsStore((store) => store.addNotification);
1010
return useMutation({
1111
mutationFn: async (data: UploadInstrumentRecordsData) => {
12-
const replacedData = JSON.parse(JSON.stringify(data, replacer)) as Json;
13-
await axios.post('/v1/instrument-records/upload', replacedData);
12+
await axios.post('/v1/instrument-records/upload', {
13+
...data,
14+
records: data.records.map((record) => ({
15+
...record,
16+
data: JSON.parse(JSON.stringify(record.data, replacer)) as Json
17+
}))
18+
} satisfies UploadInstrumentRecordsData);
1419
},
1520
onSuccess() {
1621
addNotification({ type: 'success' });

0 commit comments

Comments
 (0)