Skip to content

Commit

Permalink
feat: set swu org proposal errors
Browse files Browse the repository at this point in the history
  • Loading branch information
IanFonzie committed Dec 1, 2023
1 parent e92d6cb commit 4558712
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export interface State
isReviewPrototypePhaseAccordionOpen: boolean;
isReviewImplementationPhaseAccordionOpen: boolean;
openReviewTeamQuestionResponseAccordions: Set<number>;
existingProposalForOrganizationError: Id | null;
}

export type Msg =
Expand Down Expand Up @@ -340,7 +341,8 @@ export const init: component_.base.Init<Params, State, Msg> = ({
implementationCost: immutable(implementationCostState),
totalCost: immutable(totalCostState),
teamQuestions: immutable(teamQuestionsState),
references: immutable(referencesState)
references: immutable(referencesState),
existingProposalForOrganizationError: null
},
[
...component_.cmd.mapMany(tabbedFormCmds, (msg) =>
Expand Down Expand Up @@ -380,9 +382,14 @@ export function setErrors(
state: Immutable<State>,
errors?: Errors
): Immutable<State> {
const organizationErrors = errors?.organization
? errors.organization
: errors?.existingOrganizationProposal
? errors.existingOrganizationProposal.errors
: [];
return state
.update("organization", (s) =>
FormField.setErrors(s, errors?.organization || [])
FormField.setErrors(s, organizationErrors || [])
)
.update("team", (s) =>
Team.setErrors(s, {
Expand Down Expand Up @@ -415,6 +422,12 @@ export function setErrors(
)
.update("references", (s) =>
References.setErrors(s, errors?.references || [])
)
.set(
"existingProposalForOrganizationError",
errors?.existingOrganizationProposal
? errors.existingOrganizationProposal.proposalId
: null
);
}

Expand Down

0 comments on commit 4558712

Please sign in to comment.