forked from Nutlope/roomGPT
-
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.
redirecting to /dream if user is not logged in and visits pricing page
- Loading branch information
Showing
2 changed files
with
17 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { NextResponse } from "next/server"; | ||
import type { NextRequest } from "next/server"; | ||
|
||
// Redirect to /dream if the user is not logged in | ||
export function middleware(request: NextRequest) { | ||
let cookie = request.cookies.get("next-auth.session-token")?.value; | ||
if (cookie) { | ||
return NextResponse.next(); | ||
} else { | ||
return NextResponse.redirect(new URL("/dream", request.url)); | ||
} | ||
} | ||
|
||
export const config = { | ||
matcher: "/buy-credits", | ||
}; |
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