Skip to content

Commit

Permalink
fix: logged in state checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nzambello committed Mar 14, 2024
1 parent 66464e2 commit 6e20c90
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/LoginDrawer/LoginDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const LoginDrawer = ({
setRedirectTo(window.location.href);
}, []);

const isUserLoggedIn = user && loginToken;
const isUserLoggedIn = user?.userID && loginToken;

const login = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
Expand Down
4 changes: 2 additions & 2 deletions src/components/MemoriWidget/MemoriWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ const MemoriWidget = ({
avatarURL: typeof userAvatar === 'string' ? userAvatar : undefined,
} as User);
useEffect(() => {
if (loginToken && !user?.userID) {
if (loginToken && !user?.userID && showLogin) {
client.backend.getCurrentUser(loginToken).then(({ user, resultCode }) => {
if (user && resultCode === 0) {
setUser(user);
Expand Down Expand Up @@ -2674,7 +2674,7 @@ const MemoriWidget = ({
clickedStart: clickedStart,
onClickStart: onClickStart,
initializeTTS: initializeTTS,
isUserLoggedIn: !!loginToken,
isUserLoggedIn: !!loginToken && !!user?.userID,
showLogin,
setShowLoginDrawer,
user,
Expand Down

0 comments on commit 6e20c90

Please sign in to comment.