ai / client /src /components /Auth /ApiErrorWatcher.tsx
Marco Beretta
LibreChat upload repo
3b6afc0
raw
history blame
No virus
470 Bytes
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;