Prevent navigation from login / logout links in user menu in room
This commit is contained in:
parent
35c11660a3
commit
c4f335ebb6
4 changed files with 8 additions and 8 deletions
|
@ -13,7 +13,7 @@ import { useLocation } from "react-router-dom";
|
|||
import { Body } from "./typography/Typography";
|
||||
|
||||
export function UserMenu({
|
||||
disableLogout,
|
||||
preventNavigation,
|
||||
isAuthenticated,
|
||||
isPasswordlessUser,
|
||||
displayName,
|
||||
|
@ -32,7 +32,7 @@ export function UserMenu({
|
|||
label: displayName,
|
||||
});
|
||||
|
||||
if (isPasswordlessUser) {
|
||||
if (isPasswordlessUser && !preventNavigation) {
|
||||
arr.push({
|
||||
key: "login",
|
||||
label: "Sign In",
|
||||
|
@ -40,7 +40,7 @@ export function UserMenu({
|
|||
});
|
||||
}
|
||||
|
||||
if (!isPasswordlessUser && !disableLogout) {
|
||||
if (!isPasswordlessUser && !preventNavigation) {
|
||||
arr.push({
|
||||
key: "logout",
|
||||
label: "Sign Out",
|
||||
|
@ -50,7 +50,7 @@ export function UserMenu({
|
|||
}
|
||||
|
||||
return arr;
|
||||
}, [isAuthenticated, isPasswordlessUser, displayName, disableLogout]);
|
||||
}, [isAuthenticated, isPasswordlessUser, displayName, preventNavigation]);
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return (
|
||||
|
|
|
@ -6,7 +6,7 @@ import { useModalTriggerState } from "./Modal";
|
|||
import { ProfileModal } from "./profile/ProfileModal";
|
||||
import { UserMenu } from "./UserMenu";
|
||||
|
||||
export function UserMenuContainer({ disableLogout }) {
|
||||
export function UserMenuContainer({ preventNavigation }) {
|
||||
const location = useLocation();
|
||||
const history = useHistory();
|
||||
const { isAuthenticated, isPasswordlessUser, logout, userName, client } =
|
||||
|
@ -34,7 +34,7 @@ export function UserMenuContainer({ disableLogout }) {
|
|||
return (
|
||||
<>
|
||||
<UserMenu
|
||||
disableLogout={disableLogout}
|
||||
preventNavigation={preventNavigation}
|
||||
isAuthenticated={isAuthenticated}
|
||||
isPasswordlessUser={isPasswordlessUser}
|
||||
avatarUrl={avatarUrl}
|
||||
|
|
|
@ -121,7 +121,7 @@ export function InCallView({
|
|||
</LeftNav>
|
||||
<RightNav>
|
||||
<GridLayoutMenu layout={layout} setLayout={setLayout} />
|
||||
<UserMenuContainer disableLogout />
|
||||
<UserMenuContainer preventNavigation />
|
||||
</RightNav>
|
||||
</Header>
|
||||
{items.length === 0 ? (
|
||||
|
|
|
@ -49,7 +49,7 @@ export function RoomAuthView() {
|
|||
<HeaderLogo />
|
||||
</LeftNav>
|
||||
<RightNav>
|
||||
<UserMenuContainer disableLogout />
|
||||
<UserMenuContainer preventNavigation />
|
||||
</RightNav>
|
||||
</Header>
|
||||
<div className={styles.container}>
|
||||
|
|
Loading…
Reference in a new issue