feat: cms cache
This commit is contained in:
@@ -6,7 +6,7 @@ import { resolve as resolveEntry } from "@/utils/entry"
|
||||
import { findLang } from "@/utils/languages"
|
||||
import { removeTrailingSlash } from "@/utils/url"
|
||||
|
||||
import { getDefaultRequestHeaders } from "./utils"
|
||||
import { fetchAndCacheEntry, getDefaultRequestHeaders } from "./utils"
|
||||
|
||||
import type { NextMiddleware } from "next/server"
|
||||
|
||||
@@ -21,7 +21,10 @@ export const middleware: NextMiddleware = async (request) => {
|
||||
const pathNameWithoutLang = pathWithoutTrailingSlash.replace(`/${lang}`, "")
|
||||
const searchParams = new URLSearchParams(request.nextUrl.searchParams)
|
||||
|
||||
const { contentType, uid } = await resolveEntry(pathNameWithoutLang, lang)
|
||||
const { contentType, uid } = await fetchAndCacheEntry(
|
||||
pathNameWithoutLang,
|
||||
lang
|
||||
)
|
||||
|
||||
if (!contentType || !uid) {
|
||||
throw notFound(
|
||||
|
||||
Reference in New Issue
Block a user