Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADJUST1-469 Fixed bug with session expiring. #191

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions server/routes/remandRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export default class RemandRoutes {
throw FullPageError.notFoundError()
}
const adjustment = this.adjustmentsStoreService.getById(req, nomsId, id)
if (!adjustment) {
return res.redirect(`/${nomsId}`)
}
const adjustments = Object.values(this.adjustmentsStoreService.getAll(req, nomsId))

const form = RemandDatesForm.fromAdjustment(adjustment)
Expand Down Expand Up @@ -99,6 +102,9 @@ export default class RemandRoutes {
}

const adjustment = this.adjustmentsStoreService.getById(req, nomsId, id)
if (!adjustment) {
return res.redirect(`/${nomsId}`)
}
const sentencesAndOffences = await this.prisonerService.getSentencesAndOffencesFilteredForRemand(bookingId, token)
const form = RemandOffencesForm.fromAdjustment(adjustment, sentencesAndOffences)

Expand Down
6 changes: 6 additions & 0 deletions server/routes/taggedBailRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export default class TaggedBailRoutes {
const { bookingId, prisonerNumber } = res.locals.prisoner
const sentencesAndOffences = await this.prisonerService.getSentencesAndOffences(bookingId, token)
const adjustment = this.adjustmentsStoreService.getById(req, nomsId, id)
if (!adjustment) {
return res.redirect(`/${nomsId}`)
}

return res.render('pages/adjustments/tagged-bail/select-case', {
model: new TaggedBailSelectCaseModel(prisonerNumber, sentencesAndOffences, addOrEdit, id, adjustment),
Expand All @@ -57,6 +60,9 @@ export default class TaggedBailRoutes {
const { caseSequence } = req.query as Record<string, string>
const { prisonerNumber } = res.locals.prisoner
const adjustment = this.adjustmentsStoreService.getById(req, nomsId, id)
if (!adjustment) {
return res.redirect(`/${nomsId}`)
}
if (caseSequence) {
this.adjustmentsStoreService.store(req, nomsId, id, {
...adjustment,
Expand Down