client: stop middleware from signing out on /signout pre-fetch

This commit is contained in:
Max Leiter 2022-04-02 00:50:41 -07:00
parent 52dc5e41a5
commit 5e9288e9fb
No known key found for this signature in database
GPG key ID: A3512F2F2F17EBDA

View file

@ -12,7 +12,7 @@ export function middleware(req: NextRequest) {
// header added when next/link pre-fetches a route
!req.headers.get('x-middleware-preflight')
if (pathname === '/signout') {
if (!req.headers.get('x-middleware-preflight') && pathname === '/signout') {
// If you're signed in we remove the cookie and redirect to the home page
// If you're not signed in we redirect to the home page
if (signedIn) {