From 35631106fec3a0ee7b9a22b0fc7d6fb94ce8a527 Mon Sep 17 00:00:00 2001 From: MyNameIsBatman Date: Mon, 21 Jun 2021 02:10:43 -0300 Subject: [PATCH] Eslint fixes --- src/views/auth/AuthView.tsx | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/views/auth/AuthView.tsx b/src/views/auth/AuthView.tsx index 4965f6a8..5d575488 100644 --- a/src/views/auth/AuthView.tsx +++ b/src/views/auth/AuthView.tsx @@ -45,6 +45,21 @@ export const AuthView: FC = props => setFields(fieldsClone); }, [ fields ]); + const handleAuthentication = useCallback((data: any) => + { + setIsLoading(false); + + if(!data) return; + + let ssoFieldName = 'sso'; + + if(GetConfiguration('auth.system.http.enabled')) ssoFieldName = GetConfiguration('auth.system.sso_field_name', 'sso'); + + if(!data[ssoFieldName]) return; + + window.location.href = window.location.origin + '/?sso=' + data[ssoFieldName]; + }, []); + const sendHttpAuthentication = useCallback((body: string) => { const endpoint = (GetConfiguration('auth.system.http.endpoint.' + (showLogin ? 'login' : 'register')) as string); @@ -66,7 +81,7 @@ export const AuthView: FC = props => return null; }) .then(data => handleAuthentication(data)); - }, [ showLogin ]); + }, [handleAuthentication, showLogin]); const sendPacketAuthentication = useCallback((keys: string[], values: string[]) => { @@ -75,21 +90,6 @@ export const AuthView: FC = props => CreateMessageHook(AuthenticationEvent, event => handleAuthentication(Object.entries(event.parser))); - const handleAuthentication = useCallback((data: any) => - { - setIsLoading(false); - - if(!data) return; - - let ssoFieldName = 'sso'; - - if(GetConfiguration('auth.system.http.enabled')) ssoFieldName = GetConfiguration('auth.system.sso_field_name', 'sso'); - - if(!data[ssoFieldName]) return; - - window.location.href = window.location.origin + '/?sso=' + data[ssoFieldName]; - }, []); - const sendAuthentication = useCallback(() => { const recaptchaFieldName = GetConfiguration('auth.system.recaptcha.field_name'); @@ -137,7 +137,7 @@ export const AuthView: FC = props => { sendPacketAuthentication(requestKeys, requestValues); } - }, [ fields, recaptchaPublicKey, recaptchaAnswer ]); + }, [recaptchaPublicKey, recaptchaAnswer, fields, sendHttpAuthentication, sendPacketAuthentication]); const handleAction = useCallback((action: string, value?: string) => { @@ -155,7 +155,7 @@ export const AuthView: FC = props => sendAuthentication(); return; } - }, [ fields, recaptchaAnswer ]); + }, [sendAuthentication]); if(!fields) return null;