mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 06:17:36 -02:30
update NotifyAndRedirect to function component
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, { Component } from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { Redirect, withRouter } from 'react-router-dom';
|
import { Redirect, withRouter } from 'react-router-dom';
|
||||||
|
|
||||||
@@ -6,39 +6,39 @@ import { Trans } from '@lingui/macro';
|
|||||||
|
|
||||||
import { withRootDialog } from '../contexts/RootDialog';
|
import { withRootDialog } from '../contexts/RootDialog';
|
||||||
|
|
||||||
class NotifyAndRedirect extends Component {
|
const NotifyAndRedirect = ({
|
||||||
constructor (props) {
|
to,
|
||||||
super(props);
|
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;
|
return (
|
||||||
setRootDialogMessage({
|
<Redirect
|
||||||
title: '404',
|
to={to}
|
||||||
bodyText: (
|
push={push}
|
||||||
<Trans>
|
from={from}
|
||||||
Cannot find route
|
exact={exact}
|
||||||
<strong>{` ${location.pathname}`}</strong>
|
strict={strict}
|
||||||
.
|
sensitive={sensitive}
|
||||||
</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}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { NotifyAndRedirect as _NotifyAndRedirect };
|
export { NotifyAndRedirect as _NotifyAndRedirect };
|
||||||
export default withRootDialog(withRouter(NotifyAndRedirect));
|
export default withRootDialog(withRouter(NotifyAndRedirect));
|
||||||
|
|||||||
Reference in New Issue
Block a user