diff --git a/src/toast/ToastLogin.tsx b/src/toast/ToastLogin.tsx new file mode 100644 index 0000000..1277716 --- /dev/null +++ b/src/toast/ToastLogin.tsx @@ -0,0 +1,42 @@ +import { toast } from 'react-toastify'; +import { useTranslation } from 'react-i18next'; +// Custom message component +const LoginMessage = (props: ToastLoginProps) => { + const { t } = useTranslation(); + const handleClick = () => { + const currentUrl = window.location.href; + const redirect = encodeURIComponent(props?.redirectUrl || currentUrl); + const loginUrl = props?.loginUrl || '/user/login/'; + const newUrl = location.origin + loginUrl + '?redirect=' + redirect; + window.open(newUrl, '_self'); + }; + + return ( +
{t('Please login')}
+{t('Click here to go to the login page.')}
+