Commit dbac7412 authored by Lucas Susin's avatar Lucas Susin
Browse files

Erro de UI flickering nas rotas protegidas corrigido

parent efc5e551
Showing with 11 additions and 3 deletions
+11 -3
......@@ -9,12 +9,16 @@ export function withPublic(Component: any) {
const pathname = router.pathname;
useEffect(() => {
if (auth.user) {
if(auth.user) {
router.push('/admin');
}
});
return <Component auth={auth} pathname={pathname} {...props} />;
if(auth.user) {
return <h1 className="ant-message">Loading...</h1>;
} else {
return <Component auth={auth} pathname={pathname} {...props} />;
}
};
}
......@@ -30,6 +34,10 @@ export function withProtected(Component: any) {
}
});
return <Component auth={auth} pathname={pathname} {...props} />;
if(!auth.user) {
return <h1 className="ant-message">Loading...</h1>;
} else {
return <Component auth={auth} pathname={pathname} {...props} />;
}
};
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment