fix: cleanup logs

This commit is contained in:
Matilda Landström
2024-05-22 11:11:19 +02:00
parent e65145687d
commit e3e4d6c1c8
4 changed files with 8 additions and 15 deletions

View File

@@ -40,7 +40,7 @@ import type { MiddlewareMatcher } from "@/types/middleware"
export const middleware = auth(async (request) => {
const { nextUrl } = request
const lang = findLang(nextUrl.pathname)!
console.log("TestTest ", nextUrl)
const isLoggedIn = !!request.auth
const hasError = request.auth?.error

View File

@@ -8,24 +8,15 @@ import type { NextMiddleware } from "next/server"
import type { MiddlewareMatcher } from "@/types/middleware"
export const middleware: NextMiddleware = (request) => {
console.log("HEJ", request)
const currentwebUrl = request.nextUrl.searchParams.get("currentweb")
if (currentwebUrl == null) {
if (currentwebUrl == null || undefined) {
return badRequest()
}
const lang = findLang(request.nextUrl.pathname)!
//const headers = new Headers(request.headers)
//headers.set("x-returnurl", returnUrl)
return NextResponse.rewrite(new URL(`/${lang}/logout`, request.nextUrl), {
/*request: {
headers,
},*/
})
return NextResponse.rewrite(new URL(`/${lang}/logout`, request.nextUrl))
}
export const matcher: MiddlewareMatcher = (request) => {
return request.nextUrl.pathname.endsWith("/updatelogout") //?currentweb")
return request.nextUrl.pathname.endsWith("/updatelogout")
}