feat: Implement a new dashboard layout with sidebar, introduce project and data source management, and add various UI components.
This commit is contained in:
@@ -1,6 +1,21 @@
|
||||
import { convexAuthNextjsMiddleware } from "@convex-dev/auth/nextjs/server";
|
||||
import {
|
||||
convexAuthNextjsMiddleware,
|
||||
createRouteMatcher,
|
||||
isAuthenticatedNextjs,
|
||||
nextjsMiddlewareRedirect,
|
||||
} from "@convex-dev/auth/nextjs/server";
|
||||
|
||||
export default convexAuthNextjsMiddleware();
|
||||
const isSignInPage = createRouteMatcher(["/auth"]);
|
||||
const isProtectedPage = createRouteMatcher(["/dashboard(.*)"]);
|
||||
|
||||
export default convexAuthNextjsMiddleware(async (request) => {
|
||||
if (isSignInPage(request) && (await isAuthenticatedNextjs())) {
|
||||
return nextjsMiddlewareRedirect(request, "/dashboard");
|
||||
}
|
||||
if (isProtectedPage(request) && !(await isAuthenticatedNextjs())) {
|
||||
return nextjsMiddlewareRedirect(request, "/auth");
|
||||
}
|
||||
});
|
||||
|
||||
export const config = {
|
||||
// The following matcher runs middleware on all routes
|
||||
|
||||
Reference in New Issue
Block a user