import { useSnackbar } from 'notistack';

export default function useApiToast() {
    const { enqueueSnackbar } = useSnackbar();

    const handleError = (error, defaultMessage = 'API error') => {
        console.error(error);
        enqueueSnackbar(defaultMessage, { variant: 'error' });
    };

    return { handleError };
}