Closed lukevella closed 2 weeks ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
app | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Sep 13, 2024 4:38pm |
landing | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Sep 13, 2024 4:38pm |
The changes introduce a new POST endpoint for user logout in a Next.js application, implemented in route.ts
. This endpoint resets the user state and responds with a success message. The LogoutButton
component has been modified to directly call this endpoint instead of using the signOut
function from NextAuth, enabling a more customized logout process. Additionally, locale detection based on the "accept-language" header is now incorporated into user session management, affecting both guest initialization and user reset functionalities. A previously existing logout route has been removed.
Files | Change Summary |
---|---|
apps/web/src/app/api/logout/route.ts |
Introduced a POST endpoint for user logout that resets user state and returns a success response. |
apps/web/src/app/components/logout-button.tsx |
Removed dependency on signOut from NextAuth; now makes a direct POST request to the logout endpoint and handles redirection manually. Captures logout events using PostHog. |
apps/web/src/app/guest.ts |
Added locale detection from the "accept-language" header; modified resetUser and initGuest functions to accept the request object for locale processing. |
apps/web/src/middleware.ts |
Simplified locale handling by introducing getLocaleFromHeader ; updated guest initialization to remove the explicit locale parameter. |
apps/web/src/app/[locale]/auth/logout/route.ts |
Removed the POST request handler for logging out users that redirected to the login page. |
LogoutButton
component, which is directly related to the logout functionality implemented in the main PR. Both PRs focus on enhancing the logout process, with #1211 capturing logout events and the main PR introducing a new API endpoint for logout.🐇 In the meadow where bunnies play,
A new path for logout has come our way.
With a hop and a skip, we say goodbye,
To sessions old, as we leap to the sky!
A sprinkle of locale, a reset so neat,
Now our users can dance on digital feet! 🌼
[!TIP]
OpenAI O1 model for chat
- We have deployed OpenAI's latest O1 model for chat. - OpenAI claims that this model has superior reasoning capabilities than their GPT-4o model. - Please share any feedback with us in the [discussions post](https://discord.com/channels/1134356397673414807/1283929536186155099).
There appears to be a race condition that results in users not being able to reset their session. This overrides the default behavior of next-auth when logging out which should help guarantee that a user will always have a session to access the app.
Summary by CodeRabbit
New Features
Changes
LogoutButton
component to use the new logout API instead of the previous library method, allowing for more control over the logout process.Bug Fixes