import { useTranslation } from 'next-i18next' import toastMethod from 'react-hot-toast' import { Toast } from 'site/components/toast/index.mjs' /* Custom toast methods */ const toastMethods = (t) => ({ info: (children) => toastMethod.custom({children}), warning: (children) => toastMethod.custom({children}), error: (children) => toastMethod.custom({children}), accent: (children) => toastMethod.custom({children}), success: (children) => toastMethod.custom({children}), for: { settingsSaved: () => toastMethod.custom( {t('settingsSaved')} ), backendError: () => toastMethod.custom( {t('backendError')} ¯\_(ツ)_/¯ ), }, }) /* * The toast hook */ export function useToast() { const { t } = useTranslation(['toast']) return toastMethods(t) }