From 35b305967491e613c2e1dc3388ff5251fde4cc54 Mon Sep 17 00:00:00 2001 From: Joe Mancuso Date: Fri, 25 Oct 2024 10:02:09 -0400 Subject: [PATCH] Refactor SessionMiddleware to share 'bag' variable in views --- src/masonite/middleware/route/SessionMiddleware.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/masonite/middleware/route/SessionMiddleware.py b/src/masonite/middleware/route/SessionMiddleware.py index 5e0a02af..8cab197d 100644 --- a/src/masonite/middleware/route/SessionMiddleware.py +++ b/src/masonite/middleware/route/SessionMiddleware.py @@ -21,6 +21,8 @@ def before(self, request, response): # actually clears them out of the session errors = Session.get("errors") request.app.make("view").share({"errors": MessageBag(errors or {}).helper}) + # TODO: remove this in Masonite 5 + request.app.make("view").share({"bag": MessageBag(errors or {}).helper}) # if any errors then re-add them to the session if errors: Session.flash("errors", errors)