Skip to content

Commit

Permalink
fix: issue with login not updating (#15761)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlebon committed Sep 8, 2023
1 parent 7ac5dd4 commit aa6a214
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/script/auth/page/ConversationJoin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ const ConversationJoinComponent = ({
}: Props & ConnectedProps & DispatchProps) => {
const nameInput = React.useRef<HTMLInputElement>(null);
const {formatMessage: _} = useIntl();
const [isLoggedIn, setIsLoggedIn] = useState<boolean>(false);

const [isLoggedIn, setIsLoggedIn] = useState(selfName !== null);
const [accentColor] = useState(AccentColor.STRONG_BLUE);
const [conversationCode, setConversationCode] = useState<string>();
const [conversationKey, setConversationKey] = useState<string>();
Expand Down Expand Up @@ -101,6 +101,12 @@ const ConversationJoinComponent = ({
});
}, []);

useEffect(() => {
if (selfName) {
setIsLoggedIn(true);
}
}, [selfName]);

const routeToApp = (conversation: string = '', domain: string = '') => {
const redirectLocation = `${UrlUtil.pathWithParams(EXTERNAL_ROUTE.WEBAPP)}${
conversation && `#/conversation/${conversation}${domain && `/${domain}`}`
Expand Down Expand Up @@ -218,7 +224,7 @@ const ConversationJoinComponent = ({
</div>
<Columns style={{display: 'flex', gap: '2rem', alignSelf: 'center', maxWidth: '100%'}}>
<Column>
{isLoggedIn ? (
{isLoggedIn && selfName ? (
<IsLoggedInColumn selfName={selfName} handleLogout={handleLogout} handleSubmit={handleSubmit} />
) : (
<Login embedded />
Expand Down

0 comments on commit aa6a214

Please sign in to comment.