Skip to content

Commit 094a1f6

Browse files
committed
feat: add hook to return list of user ids
1 parent 7d3b0cd commit 094a1f6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

apps/web/src/hooks/useInstrumentVisualization.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useInstrumentInfoQuery } from '@/hooks/useInstrumentInfoQuery';
1212
import { useInstrumentRecords } from '@/hooks/useInstrumentRecords';
1313
import { useAppStore } from '@/store';
1414
import { downloadSubjectTableExcel } from '@/utils/excel';
15+
import { useFindSession } from './useFindSession';
1516

1617
type InstrumentVisualizationRecord = {
1718
[key: string]: unknown;
@@ -54,6 +55,19 @@ export function useInstrumentVisualization({ params }: UseInstrumentVisualizatio
5455
}
5556
});
5657

58+
const usersQuery = recordsQuery.data?.map((item) => {
59+
const sessionInfo = useFindSession({
60+
enabled: true,
61+
params: { id: item.sessionId }
62+
});
63+
if (sessionInfo.data) {
64+
return sessionInfo.data.userId;
65+
}
66+
return 'N/A';
67+
});
68+
69+
console.log(usersQuery);
70+
5771
const dl = (option: 'CSV' | 'CSV Long' | 'Excel' | 'Excel Long' | 'JSON' | 'TSV' | 'TSV Long') => {
5872
if (!instrument) {
5973
notifications.addNotification({ message: t('errors.noInstrumentSelected'), type: 'error' });

0 commit comments

Comments
 (0)