Skip to content

Commit

Permalink
refactor: move session update into system_error view function
Browse files Browse the repository at this point in the history
we always want the agency index URL to be the origin when returning this
template.
  • Loading branch information
angela-tran authored and thekaveman committed May 20, 2024
1 parent 1138b27 commit deb9f68
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions benefits/enrollment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ def index(request):
analytics.returned_error(request, str(e))
sentry_sdk.capture_exception(e)

# overwrite origin so that CTA takes user to agency index
session.update(request, origin=agency.index_url)
return system_error(request)
else:
analytics.returned_error(request, str(e))
Expand Down Expand Up @@ -156,6 +154,11 @@ def retry(request):
@decorator_from_middleware(EligibleSessionRequired)
def system_error(request):
"""View handler for an enrollment system error."""

# overwrite origin so that CTA takes user to agency index
agency = session.agency(request)
session.update(request, origin=agency.index_url)

return TemplateResponse(request, TEMPLATE_SYSTEM_ERROR)


Expand Down

0 comments on commit deb9f68

Please sign in to comment.