Add redirection to pageJwtMiddleware#44
Merged
Merged
Conversation
CharlesFarris
commented
May 22, 2026
Contributor
- Update home and add-todo pages
- Update tests
- Update home and add-todo pages - Update tests
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes the page-level JWT auth behavior so unauthenticated/invalid sessions are redirected to the login page (instead of returning 401), and ensures the Home page is protected by that middleware.
Changes:
- Update
pageJwtMiddlewareto redirect to/loginon JWT failures. - Add
pageJwtMiddlewareprotection to the Home page route. - Update/extend tests to assert redirect behavior and valid-JWT rendering.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/shared/pageJwtMiddleware.ts | Wrap JWT verification to redirect to the login page on auth failure. |
| src/shared/pageJwtMiddleware.test.ts | Update middleware tests to expect redirects instead of 401s. |
| src/features/home/homePage.tsx | Protect the Home page with pageJwtMiddleware. |
| src/features/home/homePage.test.tsx | Add redirect test and update rendering test to include valid JWT cookie. |
| src/features/add-todo/addToDoPage.test.tsx | Update add-todo page test to expect redirect instead of 401 when missing JWT. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.