Skip to content

Commit

Permalink
Merge pull request #2609 from Amsterdam/bugfix/cancel-button-is-not-r…
Browse files Browse the repository at this point in the history
…edirecting-back

Annuleer button is navigating to previous page
  • Loading branch information
remyvdwereld authored Aug 30, 2024
2 parents d8a4650 + 04884ae commit e644cb6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/app/components/case/forms/SummonForm/SummonForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useSummons, useSummonTypesByTaskId } from "app/state/rest"
import WorkflowForm from "app/components/case/WorkflowForm/WorkflowForm"
import scaffold from "app/components/case/forms/SummonForm/scaffold"
import useScaffoldedFields from "app/components/shared/ConfirmScaffoldForm/hooks/useScaffoldedFields"
import useNavigation from "app/routing/useNavigation"

type Props = {
id: Components.Schemas.CaseDetail["id"]
Expand Down Expand Up @@ -54,7 +55,8 @@ const mapData = (data: SummonData) => {
const SummonForm: React.FC<Props> = ({ id, caseUserTaskId }) => {
const [data] = useSummonTypesByTaskId(caseUserTaskId)
const summonTypes = data?.results
const fields = useScaffoldedFields(scaffold, id, summonTypes)
const { navigateTo } = useNavigation()
const fields = useScaffoldedFields(scaffold, id, navigateTo, summonTypes)
const [, { execPost }] = useSummons({ lazy: true })

return (
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/case/forms/SummonForm/scaffold.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { FormPositioner } from "@amsterdam/amsterdam-react-final-form"
import { Fields } from "app/components/shared/Form/ScaffoldFields"
import InfoButton from "app/components/shared/InfoHeading/InfoButton"
import { personRoleMap } from "@amsterdam/wonen-ui/helpers/dictionaries"
import { redirect } from "react-router-dom"
import type { NavigateToFunction } from "app/routing/useNavigation"

export default (caseId: Components.Schemas.CaseDetail["id"], summonTypes?: Components.Schemas.SummonType[]) => {
export default (caseId: Components.Schemas.CaseDetail["id"], navigateTo: NavigateToFunction, summonTypes?: Components.Schemas.SummonType[]) => {
const roleEntries = Object.entries(personRoleMap)
const personRoles = roleEntries.filter(([key]) => key !== "PERSON_ROLE_PLATFORM").map(([key, label]) => ({ key, label }))
const legalEntityRoles = roleEntries.filter(([key]) => !["PERSON_ROLE_HEIR", "PERSON_ROLE_RESIDENT"].includes(key)).map(([key, label]) => ({ key, label }))
Expand Down Expand Up @@ -221,7 +221,7 @@ export default (caseId: Components.Schemas.CaseDetail["id"], summonTypes?: Compo
props: {
label: "Annuleren",
variant: "primaryInverted",
onClick: () => redirect(`/zaken/${ caseId }`)
onClick: () => navigateTo("/zaken/:id", { id: caseId })
}
},
submit: {
Expand Down

0 comments on commit e644cb6

Please sign in to comment.