diff --git a/src/api.ts b/src/api.ts index 3f80ee9..331d897 100644 --- a/src/api.ts +++ b/src/api.ts @@ -91,10 +91,10 @@ export function requestRegisterUser({ first_name, last_name, email, phone_number 'Content-Type': 'application/json', }, body: JSON.stringify({ - first_name: first_name, - last_name: last_name, + first_name, + last_name, email, - phone_number: phone_number, + phone_number, password, }), }) diff --git a/src/components/FormErrors.tsx b/src/components/FormErrors.tsx index 0b0dca7..ff45bbd 100644 --- a/src/components/FormErrors.tsx +++ b/src/components/FormErrors.tsx @@ -5,7 +5,7 @@ import { Text, StyleSheet, View } from 'react-native'; // eslint-disable-next-line @typescript-eslint/no-explicit-any const FormErrors = ({ errors }: { errors: Record }) => { if (!errors) { - return; + return []; } let errorFormatted; @@ -20,7 +20,7 @@ const FormErrors = ({ errors }: { errors: Record }) => { } if (!errorFormatted) { - return; + return []; } return ( diff --git a/src/modules/events/useEventList.tsx b/src/modules/events/useEventList.tsx index 7f967ea..b7711d1 100644 --- a/src/modules/events/useEventList.tsx +++ b/src/modules/events/useEventList.tsx @@ -65,7 +65,7 @@ const useEventList = () => { let eventData; try { const res = await fetchWithTimeout(url); - if (res.status == 418) { + if (res.status === 418) { // TODO: temporary. Remove once new website is up and running throw new Error('I am a teapot'); } diff --git a/src/modules/register/UserRegister.tsx b/src/modules/register/UserRegister.tsx index 14de836..f34a4bb 100644 --- a/src/modules/register/UserRegister.tsx +++ b/src/modules/register/UserRegister.tsx @@ -79,9 +79,7 @@ const UserRegister = () => { returnKeyType="send" onSubmitEditing={onSubmit} /> - - {registerError && isSubmitted && } - + {registerError && isSubmitted && } diff --git a/src/modules/register/useUserRegister.tsx b/src/modules/register/useUserRegister.tsx index 9cbade9..474c0ae 100644 --- a/src/modules/register/useUserRegister.tsx +++ b/src/modules/register/useUserRegister.tsx @@ -64,7 +64,7 @@ const useUserRegister = () => { Object.keys(registerError).forEach((key) => { setError(key as keyof UserRegisterFormValues, { type: 'server', message: registerError[key].join('\n') }); }); - }, [registerError]); + }, [registerError, isSubmitted, clearErrors, setError]); return { isRegisteringUser, diff --git a/src/reducers.ts b/src/reducers.ts index 51fa2ce..3a31f00 100644 --- a/src/reducers.ts +++ b/src/reducers.ts @@ -11,7 +11,6 @@ import { REGISTER_USER_SUCCESS, } from './actions'; import type { UserType } from './types/data'; -import { snakeToCamelCase } from './utils'; interface RootState { isAuthenticated: boolean;