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.
This pull request includes updates to the login and profile pages to improve session handling and user experience. The most important changes involve updating the session management logic, improving error handling, and enhancing the user interface during loading states.
Session Management Improvements:
src/pages/login.tsx
: Added session data to theuseSession
hook and updated theuseEffect
hook to handle authenticated states more effectively by usingrouter.replace
instead ofrouter.push
. Improved error handling during redirection.src/pages/profile.tsx
: Replaced the custom user context with theuseSession
hook fromnext-auth/react
for session management. Updated theuseEffect
hook to redirect unauthenticated users to the login page and added error handling for redirection issues.User Interface Enhancements:
src/pages/profile.tsx
: Enhanced the loading state by displaying a full-screen spinner while the session status is loading or the component is mounting.Type and Prop Updates:
src/pages/profile.tsx
: Updated thePageProps
andPageWithLayout
types to include layout properties and ensure proper typing for thegetStaticProps
function.