Refactor
This commit is contained in:
@@ -46,7 +46,7 @@ const entryResponseCache: Map<
|
|||||||
> = new Map()
|
> = new Map()
|
||||||
let size: number = 0
|
let size: number = 0
|
||||||
|
|
||||||
export const fetchAndCacheEntry = async (path: string, lang?: Lang) => {
|
export const fetchAndCacheEntry = async (path: string, lang: Lang) => {
|
||||||
const cacheKey = `${path + lang}`
|
const cacheKey = `${path + lang}`
|
||||||
const cachedResponse = entryResponseCache.get(cacheKey)
|
const cachedResponse = entryResponseCache.get(cacheKey)
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import type { MiddlewareMatcher } from "@/types/middleware"
|
|||||||
|
|
||||||
export const middleware: NextMiddleware = async (request) => {
|
export const middleware: NextMiddleware = async (request) => {
|
||||||
const { nextUrl } = request
|
const { nextUrl } = request
|
||||||
const lang = findLang(nextUrl.pathname)
|
const lang = findLang(nextUrl.pathname)!
|
||||||
|
|
||||||
const loginTypeHeader = request.headers.get("loginType")
|
const loginTypeHeader = request.headers.get("loginType")
|
||||||
const loginTypeSearchParam = nextUrl.searchParams.get("loginType")
|
const loginTypeSearchParam = nextUrl.searchParams.get("loginType")
|
||||||
|
|||||||
Reference in New Issue
Block a user