packages/core: use useHistory in ErrorPage instead of passing via props
This commit is contained in:
@@ -23,11 +23,7 @@ describe('<ErrorPage/>', () => {
|
||||
it('should render with status code, status message and go back link', () => {
|
||||
const rendered = render(
|
||||
wrapInThemedTestApp(
|
||||
<ErrorPage
|
||||
status="404"
|
||||
statusMessage="PAGE NOT FOUND"
|
||||
history={{ goBack: () => {} }}
|
||||
/>,
|
||||
<ErrorPage status="404" statusMessage="PAGE NOT FOUND" />,
|
||||
),
|
||||
);
|
||||
rendered.getByText(/page not found/i);
|
||||
|
||||
@@ -19,13 +19,11 @@ import { Typography, Link, Grid } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
import MicDrop from './MicDrop';
|
||||
import { useHistory } from 'react-router';
|
||||
|
||||
interface IErrorPageProps {
|
||||
status: string;
|
||||
statusMessage: string;
|
||||
history: {
|
||||
goBack: () => void;
|
||||
};
|
||||
}
|
||||
|
||||
const useStyles = makeStyles<BackstageTheme>((theme) => ({
|
||||
@@ -40,8 +38,9 @@ const useStyles = makeStyles<BackstageTheme>((theme) => ({
|
||||
},
|
||||
}));
|
||||
|
||||
const ErrorPage = ({ status, statusMessage, history }: IErrorPageProps) => {
|
||||
const ErrorPage = ({ status, statusMessage }: IErrorPageProps) => {
|
||||
const classes = useStyles();
|
||||
const history = useHistory();
|
||||
|
||||
return (
|
||||
<Grid container className={classes.container}>
|
||||
|
||||
Reference in New Issue
Block a user