fix: improve emergency route detection in AdminLayout to support localized URLs
This commit is contained in:
@@ -87,6 +87,12 @@ export default function AdminLayout({
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
const fetchUser = async () => {
|
||||
// Pular verificação para a rota de emergência (suporta com ou sem prefixo de idioma)
|
||||
if (pathname?.endsWith('/admin/backup/emergency')) {
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/auth/me');
|
||||
if (response.ok) {
|
||||
@@ -171,6 +177,15 @@ export default function AdminLayout({
|
||||
);
|
||||
}
|
||||
|
||||
// Se for a rota de emergência, renderiza apenas o conteúdo
|
||||
if (pathname?.endsWith('/admin/backup/emergency')) {
|
||||
return (
|
||||
<div className="min-h-screen bg-slate-900">
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Se não tem usuário após loading, não renderizar nada (está redirecionando)
|
||||
if (!user) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user