import { toast, ToastOptions } from 'react-toastify';

export const message = {
  success: (message: string, opts?: ToastOptions) => {
    toast.success(message, opts);
  },
  error: (message: string, opts?: ToastOptions) => {
    toast.error(message, opts);
  },
  warning: (message: string, opts?: ToastOptions) => {
    toast.warning(message, opts);
  },
  info: (message: string, opts?: ToastOptions) => {
    toast.info(message, opts);
  },
  loading: (message: string, opts?: ToastOptions) => {
    const toastId = toast.loading(message, opts);
    return () => {
      toast.dismiss(toastId);
    };
  },
};
