Upgrade react-router-dom to v5.3

This commit is contained in:
Alex Gleason
2022-03-17 20:17:28 -05:00
parent 96398a61f5
commit 1f0341aa2b
53 changed files with 269 additions and 372 deletions

View File

@@ -1,26 +1,25 @@
import PropTypes from 'prop-types';
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { withRouter } from 'react-router-dom';
import Icon from 'soapbox/components/icon';
export default class ColumnBackButton extends React.PureComponent {
export default @withRouter
class ColumnBackButton extends React.PureComponent {
static propTypes = {
to: PropTypes.string,
};
static contextTypes = {
router: PropTypes.object,
history: PropTypes.object,
};
handleClick = () => {
const { to } = this.props;
if (window.history?.length === 1) {
this.context.router.history.push(to ? to : '/');
this.props.history.push(to ? to : '/');
} else {
this.context.router.history.goBack();
this.props.history.goBack();
}
}