mirror of
https://github.com/ansible/awx.git
synced 2026-01-22 15:08:03 -03:30
update NotifyAndRedirect to function component
This commit is contained in:
parent
09a950570e
commit
83e6255ba4
@ -1,4 +1,4 @@
|
||||
import React, { Component } from 'react';
|
||||
import React from 'react';
|
||||
|
||||
import { Redirect, withRouter } from 'react-router-dom';
|
||||
|
||||
@ -6,39 +6,39 @@ import { Trans } from '@lingui/macro';
|
||||
|
||||
import { withRootDialog } from '../contexts/RootDialog';
|
||||
|
||||
class NotifyAndRedirect extends Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
const NotifyAndRedirect = ({
|
||||
to,
|
||||
push,
|
||||
from,
|
||||
exact,
|
||||
strict,
|
||||
sensitive,
|
||||
setRootDialogMessage,
|
||||
location
|
||||
}) => {
|
||||
setRootDialogMessage({
|
||||
title: '404',
|
||||
bodyText: (
|
||||
<Trans>
|
||||
Cannot find route
|
||||
<strong>{` ${location.pathname}`}</strong>
|
||||
.
|
||||
</Trans>
|
||||
),
|
||||
variant: 'warning'
|
||||
});
|
||||
|
||||
const { setRootDialogMessage, location } = this.props;
|
||||
setRootDialogMessage({
|
||||
title: '404',
|
||||
bodyText: (
|
||||
<Trans>
|
||||
Cannot find route
|
||||
<strong>{` ${location.pathname}`}</strong>
|
||||
.
|
||||
</Trans>
|
||||
),
|
||||
variant: 'warning'
|
||||
});
|
||||
}
|
||||
|
||||
render () {
|
||||
const { to, push, from, exact, strict, sensitive } = this.props;
|
||||
|
||||
return (
|
||||
<Redirect
|
||||
to={to}
|
||||
push={push}
|
||||
from={from}
|
||||
exact={exact}
|
||||
strict={strict}
|
||||
sensitive={sensitive}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Redirect
|
||||
to={to}
|
||||
push={push}
|
||||
from={from}
|
||||
exact={exact}
|
||||
strict={strict}
|
||||
sensitive={sensitive}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export { NotifyAndRedirect as _NotifyAndRedirect };
|
||||
export default withRootDialog(withRouter(NotifyAndRedirect));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user