({request})
| 18 | } |
| 19 | |
| 20 | export async function action({request}) { |
| 21 | const formData = await request.formData(); |
| 22 | const actionType = formData.get('ActionType'); |
| 23 | const university = formData.get('University'); |
| 24 | const program = formData.get('Program'); |
| 25 | if (isProgramNameInvalid(program)) { |
| 26 | throw new Error("Program names cannot contain @, |, /, \\, ?, !, or $."); |
| 27 | } |
| 28 | const programId = `${program}@${university}`; |
| 29 | const targetApplicantMajor = formData.get('TargetApplicantMajor')?.split(','); |
| 30 | const region = formData.get('Region')?.split(','); |
| 31 | const degree = formData.get('Degree'); |
| 32 | const description = formData.get('Description'); |
| 33 | const requestBody = { |
| 34 | 'newProgram': actionType === 'new', |
| 35 | 'content': { |
| 36 | ProgramID: programId, |
| 37 | University: university, |
| 38 | Program: program, |
| 39 | Region: region, |
| 40 | Degree: degree, |
| 41 | 'TargetApplicantMajor': targetApplicantMajor, |
| 42 | Description: description, |
| 43 | 'Applicants': [] |
| 44 | } |
| 45 | }; |
| 46 | await addModifyProgram(requestBody); |
| 47 | return redirect(programsProgramPath(programId)) |
| 48 | } |
| 49 | |
| 50 | function SectionTitle({children, adornment}) { |
| 51 | return ( |
nothing calls this directly
no test coverage detected