mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-22 09:56:57 +00:00
20 lines
398 B
TypeScript
20 lines
398 B
TypeScript
|
|
import axios from 'axios';
|
||
|
|
|
||
|
|
import { useNotifications } from './useNotifications';
|
||
|
|
|
||
|
|
const useAxiosError = (): UseAxiosError => {
|
||
|
|
const { notifications } = useNotifications();
|
||
|
|
|
||
|
|
return (error: unknown): void => {
|
||
|
|
if (axios.isAxiosError(error)) {
|
||
|
|
notifications.error({
|
||
|
|
message: error.message,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
};
|
||
|
|
};
|
||
|
|
|
||
|
|
type UseAxiosError = (error: unknown) => void;
|
||
|
|
|
||
|
|
export default useAxiosError;
|