mirror of
https://github.com/ansible/awx.git
synced 2026-05-25 17:47:45 -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';
|
||||
|
||||
@@ -6,11 +6,16 @@ import { Trans } from '@lingui/macro';
|
||||
|
||||
import { withRootDialog } from '../contexts/RootDialog';
|
||||
|
||||
class NotifyAndRedirect extends Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
|
||||
const { setRootDialogMessage, location } = this.props;
|
||||
const NotifyAndRedirect = ({
|
||||
to,
|
||||
push,
|
||||
from,
|
||||
exact,
|
||||
strict,
|
||||
sensitive,
|
||||
setRootDialogMessage,
|
||||
location
|
||||
}) => {
|
||||
setRootDialogMessage({
|
||||
title: '404',
|
||||
bodyText: (
|
||||
@@ -22,10 +27,6 @@ class NotifyAndRedirect extends Component {
|
||||
),
|
||||
variant: 'warning'
|
||||
});
|
||||
}
|
||||
|
||||
render () {
|
||||
const { to, push, from, exact, strict, sensitive } = this.props;
|
||||
|
||||
return (
|
||||
<Redirect
|
||||
@@ -37,8 +38,7 @@ class NotifyAndRedirect extends Component {
|
||||
sensitive={sensitive}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export { NotifyAndRedirect as _NotifyAndRedirect };
|
||||
export default withRootDialog(withRouter(NotifyAndRedirect));
|
||||
|
||||
Reference in New Issue
Block a user