feat: redesign superadmin agencies list, implement flat design, add date filters, and fix UI bugs

This commit is contained in:
Erik Silva
2025-12-11 23:39:54 -03:00
parent 053e180321
commit dc98d5dccc
129 changed files with 20730 additions and 1611 deletions

View File

@@ -10,33 +10,7 @@ export async function middleware(request: NextRequest) {
// Extrair subdomínio
const subdomain = hostname.split('.')[0];
// Se for dash.localhost - rotas administrativas (SUPERADMIN)
if (subdomain === 'dash') {
// Permitir acesso a /superadmin, /cadastro, /login
return NextResponse.next();
}
// Se for agência ({subdomain}.localhost) - validar se existe
if (hostname.includes('.')) {
try {
const res = await fetch(`${apiBase}/api/tenant/check?subdomain=${subdomain}`);
if (!res.ok) {
const baseHost = hostname.split('.').slice(1).join('.') || hostname;
const redirectUrl = new URL(url.toString());
redirectUrl.hostname = baseHost;
redirectUrl.pathname = '/';
return NextResponse.redirect(redirectUrl);
}
} catch (err) {
const baseHost = hostname.split('.').slice(1).join('.') || hostname;
const redirectUrl = new URL(url.toString());
redirectUrl.hostname = baseHost;
redirectUrl.pathname = '/';
return NextResponse.redirect(redirectUrl);
}
}
// Permitir /dashboard, /login, /clientes, etc.
// Apenas SUPERADMIN (dash.localhost)
return NextResponse.next();
}