mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 15:27:47 -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,11 +6,16 @@ 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,
|
||||||
const { setRootDialogMessage, location } = this.props;
|
exact,
|
||||||
|
strict,
|
||||||
|
sensitive,
|
||||||
|
setRootDialogMessage,
|
||||||
|
location
|
||||||
|
}) => {
|
||||||
setRootDialogMessage({
|
setRootDialogMessage({
|
||||||
title: '404',
|
title: '404',
|
||||||
bodyText: (
|
bodyText: (
|
||||||
@@ -22,10 +27,6 @@ class NotifyAndRedirect extends Component {
|
|||||||
),
|
),
|
||||||
variant: 'warning'
|
variant: 'warning'
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
render () {
|
|
||||||
const { to, push, from, exact, strict, sensitive } = this.props;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Redirect
|
<Redirect
|
||||||
@@ -37,8 +38,7 @@ class NotifyAndRedirect extends Component {
|
|||||||
sensitive={sensitive}
|
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