diff --git a/.env b/.env
index d51bae8..6b32982 100644
--- a/.env
+++ b/.env
@@ -50,7 +50,7 @@ EMAIL_USER= # refer to your email provider's documentation
EMAIL_PASSWORD= # refer to your email provider's documentation
EMAIL_HOST=localhost # refer to your email provider's documentation
EMAIL_PORT=1025 # or 465 for SSL
-EMAIL_TLS=false
+EMAIL_TLS=true
NODE_TLS_REJECT_UNAUTHORIZED=0
# NEXTJS
diff --git a/app/(public)/company-offer/_components/company-offer-form.tsx b/app/(public)/company-offer/_components/company-offer-form.tsx
index 328caaf..c8c0b6e 100644
--- a/app/(public)/company-offer/_components/company-offer-form.tsx
+++ b/app/(public)/company-offer/_components/company-offer-form.tsx
@@ -1,5 +1,7 @@
'use client';
+import { useState } from 'react';
+
import { useRouter } from 'next/navigation';
import { SubmitButton } from '@/components/ui/submit-button';
@@ -13,9 +15,11 @@ import { useTranslation } from 'react-i18next';
import { FormItem } from '@kit/ui/form';
import { Input } from '@kit/ui/input';
import { Label } from '@kit/ui/label';
+import { Spinner } from '@kit/ui/spinner';
import { Trans } from '@kit/ui/trans';
const CompanyOfferForm = () => {
+ const [isLoading, setIsLoading] = useState(false);
const router = useRouter();
const language = useTranslation().i18n.language;
const {
@@ -28,6 +32,7 @@ const CompanyOfferForm = () => {
});
const onSubmit = async (data: CompanySubmitData) => {
+ setIsLoading(true);
const formData = new FormData();
Object.entries(data).forEach(([key, value]) => {
if (value !== undefined) formData.append(key, value);
@@ -36,8 +41,13 @@ const CompanyOfferForm = () => {
try {
sendCompanyOfferEmail(data, language)
.then(() => router.push('/company-offer/success'))
- .catch((error) => alert('error: ' + error));
+ .catch((error) => {
+ setIsLoading(false);
+ alert('Could not send email at this time');
+ console.warn('error: ' + error);
+ });
} catch (err: unknown) {
+ setIsLoading(false);
if (err instanceof Error) {
console.warn('Server validation error: ' + err.message);
}
@@ -76,11 +86,15 @@ const CompanyOfferForm = () => {
-
+ {isLoading ? (
+
+ ) : (
+
+ )}
);