diff --git a/frontend/src/lib/api/studies.ts b/frontend/src/lib/api/studies.ts index 846f4491f02d2fc94425d7285ad4303dc737b0e1..d70b2eab7fe412ef7f803f2bd043f45adc42e30a 100644 --- a/frontend/src/lib/api/studies.ts +++ b/frontend/src/lib/api/studies.ts @@ -27,7 +27,11 @@ export async function createStudyAPI( startDate: Date, endDate: Date, chatDuration: number, - tests: { type: string; id?: number }[] + tests: { type: string; id?: number }[], + consentParticipation: string, + consentPrivacy: string, + consentRights: string, + consentStudyData: string ): Promise<number | null> { const response = await fetch('/api/studies', { method: 'POST', @@ -38,7 +42,11 @@ export async function createStudyAPI( start_date: formatToUTCDate(startDate), end_date: formatToUTCDate(endDate), chat_duration: chatDuration, - tests + tests, + consent_participation: consentParticipation, + consent_privacy: consentPrivacy, + consent_rights: consentRights, + consent_study_data: consentStudyData }) }); if (!response.ok) return null; diff --git a/frontend/src/routes/admin/studies/new/+page.server.ts b/frontend/src/routes/admin/studies/new/+page.server.ts index d02722fc4dcd6e14bf41e6ba4daf51b40bad1096..d26d02e0f2bd37130574894b29e34da11734ae8a 100644 --- a/frontend/src/routes/admin/studies/new/+page.server.ts +++ b/frontend/src/routes/admin/studies/new/+page.server.ts @@ -16,9 +16,16 @@ export const actions: Actions = { const consentRights = formData.get('consentRights')?.toString(); const consentStudyData = formData.get('consentStudyData')?.toString(); - console.log(title, description, startDateStr, endDateStr, chatDurationStr); - - if (!title || !startDateStr || !endDateStr || !chatDurationStr) { + if ( + !title || + !startDateStr || + !endDateStr || + !chatDurationStr || + !consentParticipation || + !consentPrivacy || + !consentRights || + !consentStudyData + ) { return { message: 'Invalid request 1' }; @@ -61,7 +68,19 @@ export const actions: Actions = { }) .filter((test) => test !== null); - await createStudyAPI(fetch, title, description, startDate, endDate, chatDuration, tests); + await createStudyAPI( + fetch, + title, + description, + startDate, + endDate, + chatDuration, + tests, + consentParticipation, + consentPrivacy, + consentRights, + consentStudyData + ); return redirect(303, '/admin/studies'); }