fix 100% height header and added auth to /pokemon

This commit is contained in:
zach
2026-02-25 20:31:13 -05:00
parent d7c5a69d1d
commit a844c37800
5 changed files with 30 additions and 16 deletions

View File

@@ -1,3 +1,14 @@
import { clerkMiddleware } from "@clerk/astro/server";
// src/middleware.ts
import { clerkMiddleware, createRouteMatcher } from '@clerk/astro/server';
import type { AstroMiddlewareRequest, AstroMiddlewareResponse } from 'astro';
export const onRequest = clerkMiddleware();
const isProtectedRoute = createRouteMatcher([
'/pokemon',
]);
export const onRequest = clerkMiddleware((auth, context) => {
if (!auth().userId && isProtectedRoute(context.request)) {
// Redirect unauthenticated users to the sign-in page
return auth().redirectToSignIn();
}
});