generated from Luis/nextjs-python-web-template
UI: Fixed missing types
This commit is contained in:
@@ -95,7 +95,7 @@ def create_service(idx: int, entity: Entity) -> ServiceCreate:
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
entity_did=entity.did,
|
entity_did=entity.did,
|
||||||
usage=[],
|
usage=[{"times_consumed": 2, "consumer_entity_did": "did:sov:test:120"}],
|
||||||
)
|
)
|
||||||
|
|
||||||
return se
|
return se
|
||||||
|
|||||||
@@ -1,22 +1,30 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
class ErrorBoundary extends React.Component {
|
interface Props {
|
||||||
constructor(props: any) {
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface State {
|
||||||
|
hasError: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ErrorBoundary extends React.Component<Props, State> {
|
||||||
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
// Define a state variable to track whether is an error or not
|
// Define a state variable to track whether is an error or not
|
||||||
this.state = { hasError: false };
|
this.state = { hasError: false };
|
||||||
}
|
}
|
||||||
static getDerivedStateFromError(error: any) {
|
static getDerivedStateFromError(error: Error): State {
|
||||||
|
// eslint-disable-line
|
||||||
// Update state so the next render will show the fallback UI
|
// Update state so the next render will show the fallback UI
|
||||||
|
|
||||||
return { hasError: true };
|
return { hasError: true };
|
||||||
}
|
}
|
||||||
componentDidCatch(error: any, errorInfo: any) {
|
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {
|
||||||
// You can use your own error logging service here
|
// You can use your own error logging service here
|
||||||
console.log({ error, errorInfo });
|
console.log({ error, errorInfo });
|
||||||
}
|
}
|
||||||
render() {
|
render(): React.ReactNode {
|
||||||
// Check if the error is thrown
|
// Check if the error is thrown
|
||||||
if (this.state.hasError) {
|
if (this.state.hasError) {
|
||||||
// You can render any custom fallback UI
|
// You can render any custom fallback UI
|
||||||
@@ -34,7 +42,6 @@ class ErrorBoundary extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return children components in case of no error
|
// Return children components in case of no error
|
||||||
|
|
||||||
return this.props.children;
|
return this.props.children;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user