(applicantId)
| 139 | } |
| 140 | |
| 141 | export async function removeApplicant(applicantId) { |
| 142 | /* |
| 143 | * Remove the applicant from the local storage and the server. |
| 144 | * @param applicantId [String]: applicantId |
| 145 | */ |
| 146 | await apiRequest(REMOVE_APPLICANT, { |
| 147 | body: { |
| 148 | ApplicantID: applicantId, |
| 149 | }, |
| 150 | }); |
| 151 | |
| 152 | const records = await getRecordByApplicant(applicantId); |
| 153 | const applicants = await getApplicants(); |
| 154 | await setApplicants(applicants.filter(p => p.ApplicantID !== applicantId)); |
| 155 | await deleteApplicantIDByDisplayName(applicantId); |
| 156 | // The backend currently blocks deletion with records, but clear stale local records defensively. |
| 157 | for (const recordId of Object.keys(records)) { |
| 158 | await deleteRecord(recordId); |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | |
| 163 | export async function isAuthApplicant(applicantId) { |
no test coverage detected