feat: cms cache
This commit is contained in:
@@ -13,7 +13,7 @@ import { decryptData } from "@/utils/aes"
|
||||
import { resolve as resolveEntry } from "@/utils/entry"
|
||||
import { findLang } from "@/utils/languages"
|
||||
|
||||
import { getDefaultRequestHeaders } from "./utils"
|
||||
import { fetchAndCacheEntry, getDefaultRequestHeaders } from "./utils"
|
||||
|
||||
import type { MiddlewareMatcher } from "@/types/middleware"
|
||||
|
||||
@@ -64,7 +64,7 @@ export const middleware: NextMiddleware = async (request) => {
|
||||
|
||||
const pathNameWithoutLang = nextUrl.pathname.replace(`/${lang}/webview`, "")
|
||||
|
||||
const { uid } = await resolveEntry(pathNameWithoutLang, lang)
|
||||
const { uid } = await fetchAndCacheEntry(pathNameWithoutLang, lang)
|
||||
if (!uid) {
|
||||
throw notFound(
|
||||
`Unable to resolve CMS entry for locale "${lang}": ${pathNameWithoutLang}`
|
||||
|
||||
Reference in New Issue
Block a user