ErrorBoundary: we do a little refactoring
This commit is contained in:
parent
10f4ea3079
commit
fd592460a4
1 changed files with 14 additions and 12 deletions
|
@ -14,18 +14,6 @@ import SiteLogo from './site-logo';
|
||||||
|
|
||||||
import type { RootState } from 'soapbox/store';
|
import type { RootState } from 'soapbox/store';
|
||||||
|
|
||||||
const goHome = () => location.href = '/';
|
|
||||||
|
|
||||||
const mapStateToProps = (state: RootState) => {
|
|
||||||
const { links, logo } = getSoapboxConfig(state);
|
|
||||||
|
|
||||||
return {
|
|
||||||
siteTitle: state.instance.title,
|
|
||||||
logo,
|
|
||||||
links,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
interface Props extends ReturnType<typeof mapStateToProps> {
|
interface Props extends ReturnType<typeof mapStateToProps> {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
@ -216,4 +204,18 @@ class ErrorBoundary extends React.PureComponent<Props, State> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function goHome() {
|
||||||
|
location.href = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
function mapStateToProps(state: RootState) {
|
||||||
|
const { links, logo } = getSoapboxConfig(state);
|
||||||
|
|
||||||
|
return {
|
||||||
|
siteTitle: state.instance.title,
|
||||||
|
logo,
|
||||||
|
links,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps)(ErrorBoundary);
|
export default connect(mapStateToProps)(ErrorBoundary);
|
||||||
|
|
Loading…
Reference in a new issue