fix bug cache

This commit is contained in:
sijinhui 2024-04-08 10:25:43 +08:00
parent bb1ed984d6
commit d2b9200bc0
2 changed files with 13 additions and 13 deletions

View File

@ -18,7 +18,7 @@ export default async function middleware(req: NextRequest) {
const session = await getToken({ req }); const session = await getToken({ req });
const isUser = await VerifiedUser(session); const isUser = await VerifiedUser(session);
const isAdminUser = await VerifiedAdminUser(session); const isAdminUser = await VerifiedAdminUser(session);
console.log('----session', session, '---isUser', isUser, '---isAdmin', isAdminUser)
// 管理员页面的api接口还是要认证的 // 管理员页面的api接口还是要认证的
if (path.startsWith('/api/admin/')) { if (path.startsWith('/api/admin/')) {
// 需要确认是管理员 // 需要确认是管理员

View File

@ -107,18 +107,18 @@ const ForceCacheHeaders = [
] ]
if (mode !== "export") { if (mode !== "export") {
nextConfig.headers = async () => { // nextConfig.headers = async () => {
return [ // return [
{ // {
source: "/:path*\\.(png|ico|txt|css|js|json|webmanifest)", // source: "/:path*\\.(png|ico|txt|css|js|json|webmanifest)",
headers: ForceCacheHeaders, // headers: ForceCacheHeaders,
}, // },
// { // {
// source: "/api/:path*", // source: "/api/:path*",
// headers: CorsHeaders, // headers: CorsHeaders,
// }, // },
]; // ];
}; // };
nextConfig.rewrites = async () => { nextConfig.rewrites = async () => {
const ret = [ const ret = [