Удален AuthContext, логика авторизации перенесена в Redux. Добавлены authSlice и authApi для управления состоянием авторизации.
22 lines
494 B
JavaScript
22 lines
494 B
JavaScript
import { Component } from "react";
|
|
|
|
class ErrorBoundary extends Component {
|
|
state = { hasError: false };
|
|
|
|
static getDerivedStateFromError() {
|
|
return { hasError: true };
|
|
}
|
|
|
|
componentDidCatch(error, info) {
|
|
console.error("ErrorBoundary caught:", error, info);
|
|
}
|
|
|
|
render() {
|
|
if (this.state.hasError) {
|
|
return <div>Произошла ошибка</div>;
|
|
}
|
|
return this.props.children;
|
|
}
|
|
}
|
|
|
|
export default ErrorBoundary; |