We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 182463a commit 895197bCopy full SHA for 895197b
1 file changed
apps/web/src/hooks/useFindSession.ts
@@ -1,12 +1,13 @@
1
-import { $Session } from '@opendatacapture/schemas/session';
2
import type { Session } from '@opendatacapture/schemas/session';
3
import axios from 'axios';
4
5
export const sessionInfo = async (sessionId: string): Promise<null | Session> => {
6
try {
7
const response = await axios.get(`/v1/sessions/${sessionId}`);
8
- const parsedResult = await $Session.parseAsync(response.data);
9
- return parsedResult;
+ if (!response.data) {
+ throw new Error('Session data does not exist');
+ }
10
+ return response.data as Session;
11
} catch (error) {
12
console.error('Error fetching session:', error);
13
throw error;
0 commit comments