diff --git a/crabfit-frontend/public/i18n/en/event.json b/crabfit-frontend/public/i18n/en/event.json index 38f1863..2287e52 100644 --- a/crabfit-frontend/public/i18n/en/event.json +++ b/crabfit-frontend/public/i18n/en/event.json @@ -23,6 +23,7 @@ "timezone": "Your time zone", "errors": { + "name_required": "Your name is needed to store your availability.", "password_incorrect": "Password is incorrect. Check your name is spelled right.", "unknown": "Failed to login. Please try again." }, diff --git a/crabfit-frontend/src/pages/Event/Event.tsx b/crabfit-frontend/src/pages/Event/Event.tsx index 1505d6a..c9dfa4b 100644 --- a/crabfit-frontend/src/pages/Event/Event.tsx +++ b/crabfit-frontend/src/pages/Event/Event.tsx @@ -226,8 +226,14 @@ const Event = (props) => { }, [timezone]); const onSubmit = async data => { + if (!data.name || data.name.length === 0) { + setFocus('name'); + return setError(t('event:form.errors.name_required')); + } + setIsLoginLoading(true); setError(null); + try { const response = await api.post(`/event/${id}/people/${data.name}`, { person: {