fix: handle empty candidate trait lists
Return empty JSON arrays from the API and normalize nullable values from older servers before rendering candidate match counts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
6969f79015
commit
fd06fbbb5d
4 changed files with 36 additions and 3 deletions
|
|
@ -115,7 +115,14 @@ export const api = {
|
|||
}),
|
||||
detachQuestion: (jobId: number, questionId: number) =>
|
||||
request<void>(`/jobs/${jobId}/questions/${questionId}`, { method: 'DELETE' }),
|
||||
candidates: (jobId: number) => request<CandidateMatch[]>(`/jobs/${jobId}/candidates`),
|
||||
candidates: async (jobId: number) => {
|
||||
const matches = await request<CandidateMatch[]>(`/jobs/${jobId}/candidates`)
|
||||
return matches.map((match) => ({
|
||||
...match,
|
||||
matchedTraits: match.matchedTraits ?? [],
|
||||
missingTraits: match.missingTraits ?? [],
|
||||
}))
|
||||
},
|
||||
invitations: (jobId: number) => request<Invitation[]>(`/jobs/${jobId}/invitations`),
|
||||
invitation: (jobId: number, invitationId: number) =>
|
||||
request<Interview>(`/jobs/${jobId}/invitations/${invitationId}`),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue