Formated Files

This commit is contained in:
Ahmad 2024-02-15 20:49:19 -05:00
parent d5631b309a
commit e768d9181f
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF
138 changed files with 1829 additions and 1851 deletions

View file

@ -1,14 +1,14 @@
import { authMiddleware, redirectToSignIn } from "@clerk/nextjs";
import { NextResponse } from "next/server";
import { authMiddleware, redirectToSignIn } from '@clerk/nextjs';
import { NextResponse } from 'next/server';
// This example protects all routes including api/trpc routes
// Please edit this to allow other routes to be public as needed.
// See https://clerk.com/docs/references/nextjs/auth-middleware for more information about configuring your Middleware
export default authMiddleware({
publicRoutes: ["/", "/api/webhook"],
publicRoutes: ['/', '/api/webhook'],
afterAuth(auth, req) {
if (auth.userId && auth.isPublicRoute) {
let path = "/select-org";
let path = '/select-org';
if (auth.orgId) {
path = `/organization/${auth.orgId}`;
@ -22,13 +22,13 @@ export default authMiddleware({
return redirectToSignIn({ returnBackUrl: req.url });
}
if (auth.userId && !auth.orgId && req.nextUrl.pathname !== "/select-org") {
const orgSelection = new URL("/select-org", req.url);
if (auth.userId && !auth.orgId && req.nextUrl.pathname !== '/select-org') {
const orgSelection = new URL('/select-org', req.url);
return NextResponse.redirect(orgSelection);
}
},
});
export const config = {
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
matcher: ['/((?!.+\\.[\\w]+$|_next).*)', '/', '/(api|trpc)(.*)'],
};