diff --git a/pkgs/clan-cli/tests/test_db_api.py b/pkgs/clan-cli/tests/test_db_api.py index 8b0a1f4..5f6e0ec 100644 --- a/pkgs/clan-cli/tests/test_db_api.py +++ b/pkgs/clan-cli/tests/test_db_api.py @@ -95,7 +95,7 @@ def create_service(idx: int, entity: Entity) -> ServiceCreate: ] }, entity_did=entity.did, - usage=[], + usage=[{"times_consumed": 2, "consumer_entity_did": "did:sov:test:120"}], ) return se diff --git a/pkgs/ui/src/components/error_boundary.tsx b/pkgs/ui/src/components/error_boundary.tsx index 11b4128..f6f8ef1 100644 --- a/pkgs/ui/src/components/error_boundary.tsx +++ b/pkgs/ui/src/components/error_boundary.tsx @@ -1,22 +1,30 @@ import React from "react"; -class ErrorBoundary extends React.Component { - constructor(props: any) { +interface Props { + children: React.ReactNode; +} + +interface State { + hasError: boolean; +} + +class ErrorBoundary extends React.Component { + constructor(props: Props) { super(props); // Define a state variable to track whether is an error or not 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 - return { hasError: true }; } - componentDidCatch(error: any, errorInfo: any) { + componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void { // You can use your own error logging service here console.log({ error, errorInfo }); } - render() { + render(): React.ReactNode { // Check if the error is thrown if (this.state.hasError) { // 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 this.props.children; } }