From 153ba5550c161c7d51e6b691693bc9fd79493f91 Mon Sep 17 00:00:00 2001 From: Joywin Bennis <107112207+joywin2003@users.noreply.github.com> Date: Mon, 7 Oct 2024 20:07:02 +0530 Subject: [PATCH 1/2] added restriction to register page --- src/middleware.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/middleware.ts b/src/middleware.ts index 8551210..789c960 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -13,9 +13,14 @@ export async function middleware(request: NextRequest) { return NextResponse.redirect(new URL("/", request.url)); } } + if (url.pathname.startsWith("/register")) { + if (token?.role !== "ADMIN") { + return NextResponse.redirect(new URL("/", request.url)); + } + } } // See "Matching Paths" below to learn more export const config = { - matcher: ["/:path*", "/"], + matcher: ["/:path*", "/", "/admin/:path*", "/register/:path*"], }; From c3a89f0013866a6fea47b1d9df1260b2d15c1e18 Mon Sep 17 00:00:00 2001 From: Joywin Bennis <107112207+joywin2003@users.noreply.github.com> Date: Mon, 7 Oct 2024 21:44:05 +0530 Subject: [PATCH 2/2] remvoed default props from navitem --- next.config.mjs | 28 ++++++++++++++++------------ src/components/navbar/nav-items.tsx | 5 ----- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index 3811d3f..ff48f27 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,17 +1,21 @@ /** @type {import('next').NextConfig} */ const nextConfig = { - - images: { - remotePatterns: [ - { - protocol: 'https', - hostname: 'tedx-sjec.github.io', - port: '', - pathname: '/**', - }, - ], - }, - + images: { + remotePatterns: [ + { + protocol: "https", + hostname: "tedx-sjec.github.io", + port: "", + pathname: "/**", + }, + { + protocol: "https", + hostname: "startup-template-sage.vercel.app", + port: "", + pathname: "/**", + }, + ], + }, }; export default nextConfig; diff --git a/src/components/navbar/nav-items.tsx b/src/components/navbar/nav-items.tsx index c0da8c4..f386673 100644 --- a/src/components/navbar/nav-items.tsx +++ b/src/components/navbar/nav-items.tsx @@ -26,10 +26,5 @@ const NavItem = ({ href, textOne, textTwo }: NavItemProps) => { ); }; -NavItem.defaultProps = { - href: "#", - textOne: "ABOUT", - textTwo: "ABOUT", -}; export default NavItem;