footer+responsivenes
This commit is contained in:
@@ -3,6 +3,28 @@ import { NextResponse } from 'next/server';
|
||||
|
||||
export default withAuth(
|
||||
function middleware(req) {
|
||||
const token = req.nextauth.token;
|
||||
const path = req.nextUrl.pathname;
|
||||
|
||||
// Protected dashboard routes - redirect to /signup if not authenticated
|
||||
const protectedRoutes = [
|
||||
'/dashboard',
|
||||
'/create',
|
||||
'/bulk-creation',
|
||||
'/analytics',
|
||||
'/pricing',
|
||||
'/settings',
|
||||
];
|
||||
|
||||
// Check if current path matches any protected route
|
||||
const isProtectedRoute = protectedRoutes.some(route => path.startsWith(route));
|
||||
|
||||
// If protected route and no token, redirect to signup
|
||||
if (isProtectedRoute && !token) {
|
||||
const signupUrl = new URL('/signup', req.url);
|
||||
return NextResponse.redirect(signupUrl);
|
||||
}
|
||||
|
||||
return NextResponse.next();
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user