Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ADapp
adapp-admin
Commits
dbac7412
Commit
dbac7412
authored
3 years ago
by
Lucas Susin
Browse files
Options
Download
Email Patches
Plain Diff
Erro de UI flickering nas rotas protegidas corrigido
parent
efc5e551
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/context/hooks/route.tsx
+11
-3
src/context/hooks/route.tsx
with
11 additions
and
3 deletions
+11
-3
src/context/hooks/route.tsx
View file @
dbac7412
...
...
@@ -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
}
/>;
}
};
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment