(requestBody)
| 259 | } |
| 260 | |
| 261 | export async function addModifyProgram(requestBody) { |
| 262 | /* |
| 263 | * Set the program (with description) to the local storage (i.e. localforage.getItem('programs') and localforage.getItem(`${programId}-Desc`), and post to the server. |
| 264 | * @param program [Object]: program (with description) |
| 265 | */ |
| 266 | let content = requestBody.content; |
| 267 | if (!requestBody.newProgram) { |
| 268 | const originalProgram = await getProgram(content.ProgramID); |
| 269 | content = {...content, Applicants: originalProgram.Applicants}; |
| 270 | } |
| 271 | await apiRequest(ADD_MODIFY_PROGRAM, { |
| 272 | body: { |
| 273 | newProgram: requestBody.newProgram, |
| 274 | content, |
| 275 | }, |
| 276 | }); |
| 277 | await setProgramContent(content); |
| 278 | } |
| 279 | |
| 280 | function normalizeQueryValues(value) { |
| 281 | const values = typeof value === 'string' ? value.split(',').filter(Boolean) : value; |
no test coverage detected