Perf improvements and billing updates

This commit is contained in:
giancarlo
2024-03-26 16:49:11 +08:00
parent 8626ea30c7
commit 4032aed827
39 changed files with 1261 additions and 1090 deletions

View File

@@ -143,12 +143,14 @@ function getPatterns() {
const supabase = createMiddlewareClient(req, res);
const { data, error } = await supabase.auth.getSession();
const origin = req.nextUrl.origin;
const next = req.nextUrl.pathname;
// If user is not logged in, redirect to sign in page.
if (!data.session || error) {
return NextResponse.redirect(
new URL(pathsConfig.auth.signIn, origin).href,
);
const signIn = pathsConfig.auth.signIn;
const redirectPath = `${signIn}?next=${next}`;
return NextResponse.redirect(new URL(redirectPath, origin).href);
}
const requiresMultiFactorAuthentication =