Skip to content

Commit 21cd17b

Browse files
committed
feat: user current user from store for user
1 parent 40cc2ac commit 21cd17b

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

apps/web/src/components/StartSessionForm/StartSessionForm.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable perfectionist/sort-objects */
22

3+
import type { CurrentUser } from '@/store/types';
34
import { Form } from '@douglasneuroinformatics/libui/components';
45
import { useTranslation } from '@douglasneuroinformatics/libui/hooks';
56
import type { FormTypes } from '@opendatacapture/runtime-core';
@@ -9,7 +10,6 @@ import { $SessionType } from '@opendatacapture/schemas/session';
910
import type { CreateSessionData } from '@opendatacapture/schemas/session';
1011
import { $SubjectIdentificationMethod } from '@opendatacapture/schemas/subject';
1112
import type { Sex, SubjectIdentificationMethod } from '@opendatacapture/schemas/subject';
12-
import type { User } from '@opendatacapture/schemas/user';
1313
import { encodeScopedSubjectId, generateSubjectHash } from '@opendatacapture/subject-utils';
1414
import type { Promisable } from 'type-fest';
1515
import { z } from 'zod/v4';
@@ -33,7 +33,7 @@ type StartSessionFormData = {
3333

3434
type StartSessionFormProps = {
3535
currentGroup: Group | null;
36-
currentUser: User | null;
36+
currentUser: CurrentUser | null;
3737
initialValues?: FormTypes.PartialNullableData<StartSessionFormData>;
3838
onSubmit: (data: CreateSessionData) => Promisable<void>;
3939
readOnly: boolean;
@@ -252,7 +252,7 @@ export const StartSessionForm = ({
252252
await onSubmit({
253253
date: sessionDate,
254254
groupId: currentGroup?.id ?? null,
255-
userId: currentUser?.id ?? null,
255+
userId: currentUser?.username ?? null,
256256
type: sessionType,
257257
subjectData: {
258258
id: subjectId,

apps/web/src/routes/_app/session/start-session.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const RouteComponent = () => {
4343
</PageHeader>
4444
<StartSessionForm
4545
currentGroup={currentGroup}
46-
currentUse={currentUser}
46+
currentUser={currentUser}
4747
initialValues={initialValues}
4848
readOnly={currentSession !== null || createSessionMutation.isPending}
4949
onSubmit={async (formData) => {

0 commit comments

Comments
 (0)