This repository has been archived by the owner on Aug 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor components to use updated Clerk/Next.js imports
- Loading branch information
Showing
8 changed files
with
51 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,16 @@ | ||
import { authMiddleware } from "@clerk/nextjs"; | ||
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server"; | ||
|
||
/** | ||
* Configures authentication middleware with public and ignored routes. | ||
* | ||
* @param config - Configuration object with `publicRoutes` and `ignoredRoutes` arrays. | ||
* `publicRoutes` defines routes that can be accessed while signed out. | ||
* `ignoredRoutes` defines routes that can always be accessed without authentication. | ||
*/ | ||
export default authMiddleware({ | ||
// Routes that can be accessed while signed out | ||
publicRoutes: [ | ||
"/", | ||
"/:username", | ||
"/api/github", | ||
"/api/star-history", | ||
"/blog/:postId", | ||
], | ||
// Routes that can always be accessed, and have | ||
// no authentication information | ||
ignoredRoutes: [""], | ||
const isDashboardRoute = createRouteMatcher(["/dashboard(.*)"]); | ||
const isAdminRoute = createRouteMatcher(["/admin(.*)"]); | ||
|
||
export default clerkMiddleware((auth, req) => { | ||
// Restrict admin route to users with specific role | ||
if (isAdminRoute(req)) auth().protect({ role: "org:admin" }); | ||
|
||
// Restrict dashboard routes to signed in users | ||
if (isDashboardRoute(req)) auth().protect(); | ||
}); | ||
|
||
export const config = { | ||
// Protects all routes, including api/trpc. | ||
// See https://clerk.com/docs/references/nextjs/auth-middleware | ||
// for more information about configuring your Middleware | ||
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"], | ||
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89a33a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
github-profile-viewer – ./
github-profile-viewer-git-master-samets-projects-538a8f28.vercel.app
github-profile-viewer-samets-projects-538a8f28.vercel.app
next-github-profile-viewer.vercel.app
githubprofileviewer.com
www.githubprofileviewer.com