Add bool prop "forceReload" to DropdownLink component
This commit is contained in:
parent
b8088acfae
commit
747d9f0c51
2 changed files with 11 additions and 4 deletions
|
@ -604,16 +604,23 @@ export class LinkButton extends Component {
|
|||
export class DropdownLink extends Component {
|
||||
static propTypes = {
|
||||
to: PropTypes.string,
|
||||
className: PropTypes.string
|
||||
className: PropTypes.string,
|
||||
forceReload: PropTypes.bool
|
||||
}
|
||||
|
||||
render() {
|
||||
const props = this.props;
|
||||
|
||||
const clsName = "dropdown-item" + (props.className ? " " + props.className : "")
|
||||
if (props.forceReload) {
|
||||
return (
|
||||
<Link to={props.to} className={clsName} onClick={() => window.location.href=props.to}>{props.children}</Link>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Link to={props.to} className={clsName}>{props.children}</Link>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class Root extends Component {
|
|||
{getLanguageChooser(t)}
|
||||
<NavDropdown menuClassName="dropdown-menu-right" label={mailtrainConfig.user.username} icon="user">
|
||||
<DropdownLink to="/account"><Icon icon='user'/> {t('account')}</DropdownLink>
|
||||
{mailtrainConfig.authMethod == 'cas' && <DropdownLink to="/cas/logout"><Icon icon="sign-out-alt"/> {t('logOut')}</DropdownLink>}
|
||||
{mailtrainConfig.authMethod == 'cas' && <DropdownLink to="/cas/logout" forceReload=true><Icon icon="sign-out-alt"/> {t('logOut')}</DropdownLink>}
|
||||
{mailtrainConfig.authMethod != 'cas' && <DropdownActionLink onClickAsync={::this.logout}><Icon icon='sign-out-alt'/> {t('logOut')}</DropdownActionLink>}
|
||||
</NavDropdown>
|
||||
</ul>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue