fix(SW-135): invalidate router cache on logout for my pages
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { revalidatePath } from "next/cache"
|
||||
import { NextRequest, NextResponse } from "next/server"
|
||||
import { AuthError } from "next-auth"
|
||||
|
||||
@@ -94,6 +95,9 @@ export async function GET(
|
||||
redirect: false,
|
||||
})
|
||||
|
||||
// Revalidate the router cache for my pages to make sure we don't show stale user data
|
||||
revalidatePath("/[lang]/my-pages", "layout")
|
||||
|
||||
if (redirectUrlObj) {
|
||||
console.log(`[logout] redirecting to: ${redirectUrlObj.redirect}`)
|
||||
return NextResponse.redirect(redirectUrlObj.redirect)
|
||||
|
||||
Reference in New Issue
Block a user