Skip to content

Commit

Permalink
external link (logout) error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
delgermurun committed Oct 9, 2019
1 parent 6192727 commit f17c2bd
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
69 changes: 36 additions & 33 deletions app/components/common/MenuWithLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,41 +42,44 @@ class MenuWithLinks extends React.PureComponent<{
open={Boolean(anchorEl)}
onClose={this.handleClose}
>
{options.map(
(option, i) =>
option.separator ? (
<hr style={{ width: '85%', margin: '10px auto' }} key={`separated-${i}`} />
) : (
<MenuItem
onClick={() => {
{options.map((option, i) =>
option.separator ? (
<hr style={{ width: '85%', margin: '10px auto' }} key={`separated-${i}`} />
) : (
<MenuItem
onClick={() => {
if (option.external) {
window.location.href = option.href;
} else {
Router.push(option.href, option.as || option.href);
this.handleClose();
}}
key={option.href}
style={{
fontWeight: router.asPath.includes(option.highlighterSlug) ? 600 : 300,
fontSize: '14px',
}}
>
{option.avatarUrl ? (
<Avatar
src={`${option.avatarUrl ||
'https://storage.googleapis.com/async-await/async-logo-40.svg'}`}
alt="Team logo"
style={{
margin: '0px 10px 0px 0px',
cursor: 'pointer',
display: 'inline-flex',
height: '32px',
width: '32px',
verticalAlign: 'middle',
}}
/>
) : null}
}
this.handleClose();
}}
key={option.href}
style={{
fontWeight: router.asPath.includes(option.highlighterSlug) ? 600 : 300,
fontSize: '14px',
}}
>
{option.avatarUrl ? (
<Avatar
src={`${option.avatarUrl ||
'https://storage.googleapis.com/async-await/async-logo-40.svg'}`}
alt="Team logo"
style={{
margin: '0px 10px 0px 0px',
cursor: 'pointer',
display: 'inline-flex',
height: '32px',
width: '32px',
verticalAlign: 'middle',
}}
/>
) : null}

{option.text}
</MenuItem>
),
{option.text}
</MenuItem>
),
)}
</Menu>
</div>
Expand Down
1 change: 1 addition & 0 deletions app/components/layout/menus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const menuOnTheRight = ({ currentTeam }: { currentTeam: Team }) => [
href: `${URL_API}/logout`,
as: `${URL_API}/logout`,
simple: true,
external: true,
},
];

Expand Down

0 comments on commit f17c2bd

Please sign in to comment.