File size: 470 Bytes
3b6afc0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import React from 'react';
import { useApiErrorBoundary } from '~/hooks/ApiErrorBoundaryContext';
import { useNavigate } from 'react-router-dom';
const ApiErrorWatcher = () => {
const { error } = useApiErrorBoundary();
const navigate = useNavigate();
React.useEffect(() => {
if (error?.response?.status === 500) {
// do something with error
// navigate('/login');
}
}, [error, navigate]);
return null;
};
export default ApiErrorWatcher;
|