Added toHome prop to BackButton

• Added:
- toHome prop to BackButton
This commit is contained in:
mgabdev 2020-06-10 12:02:56 -04:00
parent 7de58b5bf5
commit 2316494f58

View File

@ -12,10 +12,11 @@ export default class BackButton extends PureComponent {
icon: PropTypes.string,
iconClassName: PropTypes.string,
iconSize: PropTypes.string,
toHome: PropTypes.bool,
}
historyBack = () => {
if (window.history && window.history.length === 1) {
if (window.history && window.history.length === 1 || this.props.toHome) {
this.context.router.history.push('/home')
} else {
this.context.router.history.goBack()