mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-22 09:56:57 +00:00
18 lines
410 B
TypeScript
18 lines
410 B
TypeScript
|
|
import { AxiosError } from 'axios';
|
||
|
|
import { useEffect } from 'react';
|
||
|
|
|
||
|
|
import { useNotifications } from './useNotifications';
|
||
|
|
|
||
|
|
const useErrorNotification = (error: AxiosError | null): void => {
|
||
|
|
const { notifications } = useNotifications();
|
||
|
|
useEffect(() => {
|
||
|
|
if (error) {
|
||
|
|
notifications.error({
|
||
|
|
message: error.message,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}, [error, notifications]);
|
||
|
|
};
|
||
|
|
|
||
|
|
export default useErrorNotification;
|