Skip to content

Commit dee44aa

Browse files
Make root page catch-all route for signup component
1 parent f82b85c commit dee44aa

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

app/page.tsx renamed to app/[[...home]]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import {
88
SignedIn,
99
SignedOut,
1010
} from "@clerk/nextjs";
11-
import { ClerkLogo } from "./components/clerk-logo";
11+
import { ClerkLogo } from "../components/clerk-logo";
1212

13-
export default function Home() {
13+
export default function Page() {
1414
return (
1515
<main className="flex flex-col justify-center items-center min-h-full p-8 pb-20 gap-4 sm:p-20 font-[family-name:var(--font-geist-sans)]">
1616
<div className="inline-flex">

app/dashboard/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Link from "next/link";
55
import { CodeSwitcher } from "../components/code-switcher";
66
import { UserDetails } from "../components/user-details";
77

8-
export default async function DashboardPage() {
8+
export default async function Page() {
99
await auth.protect();
1010

1111
return (

middleware.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1-
import { clerkMiddleware } from "@clerk/nextjs/server";
1+
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
22

3-
export default clerkMiddleware();
3+
const isPublicRoute = createRouteMatcher([
4+
"/(.*)",
5+
"/sign-in(.*)",
6+
"/sign-up(.*)",
7+
]);
8+
9+
export default clerkMiddleware(async (auth, req) => {
10+
if (!isPublicRoute(req)) {
11+
await auth.protect();
12+
}
13+
});
414

515
export const config = {
616
matcher: [

0 commit comments

Comments
 (0)