Add more efficient authentication check function to server components.

Added request logging to Next.js config.

This commit introduces a new function 'requireUserInServerComponent' which checks for user authentication and is used in multiple server components. The aim is to enhance efficiency by caching the function so that data is only fetched once per request, preventing unnecessary database hits. Existing components were modified accordingly to incorporate this new method.
This commit is contained in:
giancarlo
2024-06-04 11:54:04 +07:00
parent 16c0f07e59
commit 3261f2b582
7 changed files with 44 additions and 50 deletions

View File

@@ -30,6 +30,11 @@ const config = {
images: {
remotePatterns: getRemotePatterns(),
},
logging: {
fetches: {
fullUrl: true,
},
},
experimental: {
mdxRs: true,
instrumentationHook: true,