Skip to content

Commit 2450490

Browse files
Merge pull request #424 from topcoder-platform/PROD-3246_update-user
PROD-3246 update user when profile is ready -> PROD-3115_uni-nav
2 parents ae88227 + 6da0e30 commit 2450490

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

src-ts/header/Header.tsx

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const Header: FC = () => {
3838

3939
useEffect(() => {
4040

41-
if (headerInit.current || !profileReady || !tcUniNav) {
41+
if (headerInit.current) {
4242
return
4343
}
4444

@@ -55,10 +55,37 @@ const Header: FC = () => {
5555
signIn() { window.location.href = authUrlLogin() },
5656
signOut() { window.location.href = authUrlLogout },
5757
signUp() { window.location.href = authUrlSignup() },
58+
type: 'tool',
59+
},
60+
)
61+
}, [])
62+
63+
useEffect(() => {
64+
65+
tcUniNav(
66+
'update',
67+
navElementId,
68+
{
5869
toolName: activeToolName,
5970
toolRoute: activeToolRoute,
60-
type: 'tool',
61-
user: profileReady && profile ? {
71+
},
72+
)
73+
}, [
74+
activeToolName,
75+
activeToolRoute,
76+
])
77+
78+
useEffect(() => {
79+
80+
if (!profileReady) {
81+
return
82+
}
83+
84+
tcUniNav(
85+
'update',
86+
navElementId,
87+
{
88+
user: profile ? {
6289
handle: profile.handle,
6390
initials: `${profile.firstName.charAt(0)}${profile.lastName.charAt(0)}`,
6491
photoURL: profile.photoURL,
@@ -67,8 +94,6 @@ const Header: FC = () => {
6794
},
6895
)
6996
}, [
70-
activeToolName,
71-
activeToolRoute,
7297
profileReady,
7398
profile,
7499
])

0 commit comments

Comments
 (0)