diff --git a/server/model/taggedBailDaysModel.ts b/server/model/taggedBailDaysModel.ts index 992da6f7..fee682ab 100644 --- a/server/model/taggedBailDaysModel.ts +++ b/server/model/taggedBailDaysModel.ts @@ -19,4 +19,12 @@ export default class TaggedBailDaysModel { } return `/${this.prisonerNumber}/tagged-bail/select-case/${this.addOrEdit}/${this.id}` } + + public cancelLink(): string { + if (this.addOrEdit === 'edit') { + return `/${this.prisonerNumber}/tagged-bail/view` + } + + return `/${this.prisonerNumber}` + } } diff --git a/server/views/pages/adjustments/tagged-bail/days.njk b/server/views/pages/adjustments/tagged-bail/days.njk index 57630910..067ecd94 100644 --- a/server/views/pages/adjustments/tagged-bail/days.njk +++ b/server/views/pages/adjustments/tagged-bail/days.njk @@ -66,7 +66,7 @@ {{ govukButton({ text: "Cancel", classes: "govuk-button--secondary", - href: model.backlink() + href: model.cancelLink() }) }}