feat: middleware load auth from url

This commit is contained in:
Nevo David 2025-05-17 14:56:04 +07:00
parent 5dc72873d5
commit 52081c46d5
1 changed files with 2 additions and 1 deletions

View File

@ -6,7 +6,8 @@ import { internalFetch } from '@gitroom/helpers/utils/internal.fetch';
// This function can be marked `async` if using `await` inside
export async function middleware(request: NextRequest) {
const nextUrl = request.nextUrl;
const authCookie = request.cookies.get('auth');
const authCookie = request.cookies.get('auth') || request.headers.get('auth') || nextUrl.searchParams.get('loggedAuth');
if (
nextUrl.pathname.startsWith('/uploads/') ||
nextUrl.pathname.startsWith('/p/') ||