diff --git a/src/pages/EventCreationPage/components/EventCreationForm/schema.ts b/src/pages/EventCreationPage/components/EventCreationForm/schema.ts index 899cc68b..1df403e4 100644 --- a/src/pages/EventCreationPage/components/EventCreationForm/schema.ts +++ b/src/pages/EventCreationPage/components/EventCreationForm/schema.ts @@ -8,8 +8,10 @@ const schema = Yup.object({ location: Yup.string().required('Required'), description: Yup.string().required('Required'), hosts: Yup.array().required('Required'), - fbURL: Yup.string(), - canvaURL: Yup.string(), + fbURL: Yup.string().url('Please either enter a valid URL or leave it blank'), + canvaURL: Yup.string().url( + 'Please either enter a valid URL or leave it blank' + ), }); export default schema; diff --git a/src/pages/EventCreationPage/index.tsx b/src/pages/EventCreationPage/index.tsx index b5b48ed4..dba47bdc 100644 --- a/src/pages/EventCreationPage/index.tsx +++ b/src/pages/EventCreationPage/index.tsx @@ -17,7 +17,16 @@ function EventCreationPage(): JSX.Element { values: EventRequest, setSubmitting: (_: boolean) => void ) => { - const createdEvent = await createEvent(values); + const submission = { + ...values, + hosts: values.hosts.map(host => { + return { id: host.id }; + }), + fbURL: values.fbURL === '' ? undefined : values.fbURL, + canvaURL: values.canvaURL === '' ? undefined : values.canvaURL, + }; + + const createdEvent = await createEvent(submission); const { id } = createdEvent; setSubmitting(false); diff --git a/src/services/api/.openapi-generator/FILES b/src/services/api/.openapi-generator/FILES index 426df699..dfb244f0 100644 --- a/src/services/api/.openapi-generator/FILES +++ b/src/services/api/.openapi-generator/FILES @@ -1,28 +1,28 @@ -apis/AuthApi.ts -apis/EventApi.ts -apis/UserApi.ts -apis/index.ts +apis\AuthApi.ts +apis\EventApi.ts +apis\UserApi.ts +apis\index.ts index.ts -models/AppUserEventRequest.ts -models/AppUserEventResponse.ts -models/AppUserInductionClass.ts -models/AppUserNameResponse.ts -models/AppUserPKPayload.ts -models/AppUserPostRequest.ts -models/AppUserProfileResponse.ts -models/AppUserResponse.ts -models/AppUserRolesResponse.ts -models/AppUserSignupRequest.ts -models/AttendanceResponse.ts -models/BaseEventPayload.ts -models/EventAttendanceResponse.ts -models/EventRSVPResponse.ts -models/EventRequest.ts -models/EventResponse.ts -models/MultipleAppUserResponse.ts -models/MultipleEventResponse.ts -models/MultipleUserNameResponse.ts -models/MultipleUserQuery.ts -models/RSVPResponse.ts -models/index.ts +models\AppUserEventRequest.ts +models\AppUserEventResponse.ts +models\AppUserInductionClass.ts +models\AppUserNameResponse.ts +models\AppUserPKPayload.ts +models\AppUserPostRequest.ts +models\AppUserProfileResponse.ts +models\AppUserResponse.ts +models\AppUserRolesResponse.ts +models\AppUserSignupRequest.ts +models\AttendanceResponse.ts +models\BaseEventPayload.ts +models\EventAttendanceResponse.ts +models\EventRSVPResponse.ts +models\EventRequest.ts +models\EventResponse.ts +models\MultipleAppUserResponse.ts +models\MultipleEventResponse.ts +models\MultipleUserNameResponse.ts +models\MultipleUserQuery.ts +models\RSVPResponse.ts +models\index.ts runtime.ts diff --git a/src/services/api/.openapi-generator/VERSION b/src/services/api/.openapi-generator/VERSION index 1a487e1a..8836c812 100644 --- a/src/services/api/.openapi-generator/VERSION +++ b/src/services/api/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-beta2 \ No newline at end of file +5.0.0-beta \ No newline at end of file