@@ -19,7 +19,7 @@ import {
1919 authUserSuccess ,
2020 authUserError ,
2121 authLoadTeamMembers ,
22- authLoadUserProfile ,
22+ authLoadV5UserProfile ,
2323 authClearTeamMembers ,
2424} from "./actions" ;
2525import { decodeToken } from "tc-auth-lib" ;
@@ -36,6 +36,7 @@ export default function withAuthentication(Component) {
3636 teamMembersLoaded,
3737 teamMembersLoadingError,
3838 v5UserProfile,
39+ v5UserProfileLoading,
3940 v5UserProfileLoadingError,
4041 } = useSelector ( ( state ) => state . authUser ) ;
4142 const params = useParams ( ) ;
@@ -91,24 +92,21 @@ export default function withAuthentication(Component) {
9192
9293 useEffect ( ( ) => {
9394 if ( isLoggedIn ) {
94- dispatch ( authLoadUserProfile ( ) ) ;
95+ dispatch ( authLoadV5UserProfile ( ) ) ;
9596 }
9697 } , [ dispatch , isLoggedIn ] ) ;
9798
9899 return (
99100 < >
100101 { /* Show loading indicator until we know if user is logged-in or no.
101102 Also, show loading indicator if we need to know team members but haven't loaded them yet.
103+ or load v5 user profile but haven't loaded them yet.
102104 In we got error during this process, show error */ }
103105 { isLoggedIn === null ||
104- ( params . teamId && ! teamMembersLoaded && (
105- < LoadingIndicator error = { authError || teamMembersLoadingError } />
106+ ( ( params . teamId && ! teamMembersLoaded || v5UserProfileLoading || v5UserProfileLoadingError ) && (
107+ < LoadingIndicator error = { authError || teamMembersLoadingError || v5UserProfileLoadingError } />
106108 ) ) }
107109
108- { /* Show component only if v5 user profile load error */ }
109- { isLoggedIn === true && v5UserProfileLoadingError && (
110- < LoadingIndicator error = { v5UserProfileLoadingError } />
111- ) }
112110 { /* Show component only if user is logged-in and if we don't need team members or we already loaded them */ }
113111 { isLoggedIn === true &&
114112 v5UserProfile &&
0 commit comments