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(() => {
|
useEffect(() => {
|
||||||
setMounted(true);
|
setMounted(true);
|
||||||
const fetchUser = async () => {
|
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 {
|
try {
|
||||||
const response = await fetch('/api/auth/me');
|
const response = await fetch('/api/auth/me');
|
||||||
if (response.ok) {
|
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)
|
// Se não tem usuário após loading, não renderizar nada (está redirecionando)
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user