mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-21 22:05:38 -04:00
Convert Modal components to TypeScript
This commit is contained in:
@@ -4,6 +4,7 @@ import React, { Component, ErrorInfo } from 'react';
|
||||
interface ErrorBoundaryProps {
|
||||
children: React.ReactNode;
|
||||
errorComponent: React.ElementType;
|
||||
onModalClose?: () => void;
|
||||
}
|
||||
|
||||
interface ErrorBoundaryState {
|
||||
@@ -32,11 +33,17 @@ class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { children, errorComponent: ErrorComponent } = this.props;
|
||||
const {
|
||||
children,
|
||||
errorComponent: ErrorComponent,
|
||||
onModalClose,
|
||||
} = this.props;
|
||||
const { error, info } = this.state;
|
||||
|
||||
if (error) {
|
||||
return <ErrorComponent error={error} info={info} />;
|
||||
return (
|
||||
<ErrorComponent error={error} info={info} onModalClose={onModalClose} />
|
||||
);
|
||||
}
|
||||
|
||||
return children;
|
||||
|
||||
Reference in New Issue
Block a user