Pending course, rest ready for launch

This commit is contained in:
Marcelo
2026-03-15 13:52:11 +00:00
parent be4ca2ed78
commit 62b3cfe467
77 changed files with 6450 additions and 868 deletions

View File

@@ -29,19 +29,13 @@ export async function middleware(request: NextRequest) {
}
);
// IMPORTANT: This refreshes the session.
// IMPORTANT: This refreshes the session.
// If the user is not logged in, 'user' will be null.
const { data: { user } } = await supabase.auth.getUser();
const isTeacherRoute = request.nextUrl.pathname.startsWith("/teacher");
const isProtectedRoute =
request.nextUrl.pathname.startsWith("/courses") ||
request.nextUrl.pathname.startsWith("/practice") ||
isTeacherRoute;
const isLocalDev = process.env.NODE_ENV === 'development';
const activeUser = isLocalDev ? { id: 'f3bbd600-4c58-45b0-855b-cc8f045117c6' } : user;
console.log("ACTIVE_USER:", activeUser);
// Practice mini-games are public; auth is handled in server actions for persistence only.
const isProtectedRoute = isTeacherRoute;
// If they are trying to access a protected route and aren't logged in, redirect to login
if (isProtectedRoute && !user) {
@@ -58,4 +52,4 @@ export const config = {
matcher: [
"/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)",
],
};
};