From c9ce2bbf8cbdc18912419f79a65b7a976cc02ede Mon Sep 17 00:00:00 2001 From: Pavel Mineev Date: Thu, 8 Apr 2021 11:16:59 +0300 Subject: [PATCH] use named functions instead of arrows --- frontend/app/components/auth/auth.tsx | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/frontend/app/components/auth/auth.tsx b/frontend/app/components/auth/auth.tsx index 58a09c7d..b09c75ac 100644 --- a/frontend/app/components/auth/auth.tsx +++ b/frontend/app/components/auth/auth.tsx @@ -1,4 +1,4 @@ -import { h, Fragment, FunctionComponent } from 'preact'; +import { h, Fragment } from 'preact'; import { useState } from 'preact/hooks'; import { useIntl } from 'react-intl'; import cn from 'classnames'; @@ -17,7 +17,7 @@ import { emailSignin, verifyEmailSignin, anonymousSignin } from './auth.api'; import styles from './auth.module.css'; -const Auth: FunctionComponent = () => { +export default function Auth() { const intl = useIntl(); const dispath = useDispatch(); const [oauthProviders, formProviders] = getProviders(); @@ -30,25 +30,25 @@ const Auth: FunctionComponent = () => { // Errors const [invalidReason, setInvalidReason] = useState(null); - const handleClickSingIn = (evt: Event) => { + function handleClickSingIn(evt: Event) { evt.preventDefault(); toggleDropdownState(); - }; + } - const handleDropdownClose = (evt: Event) => { + function handleDropdownClose(evt: Event) { evt.preventDefault(); setView(formProviders[0]); toggleDropdownState(); - }; + } - const handleProviderChange = (evt: Event) => { + function handleProviderChange(evt: Event) { const { value } = evt.currentTarget as HTMLInputElement; setInvalidReason(null); setView(value as typeof formProviders[number]); - }; + } - const handleSubmit = async (evt: Event) => { + async function handleSubmit(evt: Event) { const data = new FormData(evt.target as HTMLFormElement); evt.preventDefault(); @@ -91,12 +91,12 @@ const Auth: FunctionComponent = () => { } setLoading(false); - }; + } - const handleShowEmailStep = (evt: Event) => { + function handleShowEmailStep(evt: Event) { evt.preventDefault(); setView('email'); - }; + } const hasOAuthProviders = oauthProviders.length > 0; const hasFormProviders = formProviders.length > 0; @@ -262,6 +262,4 @@ const Auth: FunctionComponent = () => { )} ); -}; - -export default Auth; +}