Skip to content

Commit

Permalink
fix: Fix return value for useAllPersonDetailsAsync (#1122)
Browse files Browse the repository at this point in the history
* fix: Fix return value for useAllPersonDetailsAsync
  • Loading branch information
taustad authored Apr 26, 2024
1 parent 9e016aa commit f8c8145
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { PersonDetails } from '@equinor/fusion-react-person'
interface Props {
connectedQuestion: Question
possibleAssignees: Participant[]
possibleAssigneesDetails: any[] // PersonDetails[]
possibleAssigneesDetails: PersonDetails[]
onActionCreate: (action: DataToCreateAction) => void
onCancelClick: () => void
disableCreate: boolean
Expand Down Expand Up @@ -41,7 +41,7 @@ const ActionCreateForm = ({
const [description, setDescription] = useState<string>('')

const assigneesOptions = possibleAssigneesDetails.map(personDetails => ({
id: personDetails?.azureUniqueId,
id: personDetails?.azureId,
title: personDetails?.name,
}))

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Action/EditForm/ActionEditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface Props {
action: Action
connectedQuestion: Question
possibleAssignees: Participant[]
possibleAssigneesDetails: any[] // PersonDetails[]
possibleAssigneesDetails: PersonDetails[]
onEditShouldDelay: (action: Action, isValid: boolean) => void
onEditShouldNotDelay: (action: Action, isValid: boolean) => void
createClosingRemark: (text: string) => void
Expand Down Expand Up @@ -79,7 +79,7 @@ const ActionEditForm = ({
useShowErrorHook(apiErrorClosingRemark)

const assigneesOptions = possibleAssigneesDetails.map(personDetails => ({
id: personDetails.azureUniqueId,
id: personDetails.azureId,
title: personDetails.name,
}))

Expand Down
5 changes: 4 additions & 1 deletion frontend/src/utils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export const useAllPersonDetailsAsync = (azureUniqueIds: string[]): PersonDetail
const getAllPersonDetails = async (azureUniqueIds: string[]): Promise<PersonDetails[]> => {
const manyPromises: Promise<PersonDetails>[] = azureUniqueIds.map(azureUniqueId => {
return apiClients.getById(azureUniqueId).then(response => {
return response
return {
azureId: response.azureUniqueId,
name: response.name,
}
})
})

Expand Down

0 comments on commit f8c8145

Please sign in to comment.