Eslint fixes

This commit is contained in:
MyNameIsBatman 2021-06-21 02:10:43 -03:00
parent f12ec625f8
commit 35631106fe

View File

@ -45,6 +45,21 @@ export const AuthView: FC<AuthViewProps> = props =>
setFields(fieldsClone); setFields(fieldsClone);
}, [ fields ]); }, [ fields ]);
const handleAuthentication = useCallback((data: any) =>
{
setIsLoading(false);
if(!data) return;
let ssoFieldName = 'sso';
if(GetConfiguration<boolean>('auth.system.http.enabled')) ssoFieldName = GetConfiguration<string>('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 sendHttpAuthentication = useCallback((body: string) =>
{ {
const endpoint = (GetConfiguration('auth.system.http.endpoint.' + (showLogin ? 'login' : 'register')) as string); const endpoint = (GetConfiguration('auth.system.http.endpoint.' + (showLogin ? 'login' : 'register')) as string);
@ -66,7 +81,7 @@ export const AuthView: FC<AuthViewProps> = props =>
return null; return null;
}) })
.then(data => handleAuthentication(data)); .then(data => handleAuthentication(data));
}, [ showLogin ]); }, [handleAuthentication, showLogin]);
const sendPacketAuthentication = useCallback((keys: string[], values: string[]) => const sendPacketAuthentication = useCallback((keys: string[], values: string[]) =>
{ {
@ -75,21 +90,6 @@ export const AuthView: FC<AuthViewProps> = props =>
CreateMessageHook(AuthenticationEvent, event => handleAuthentication(Object.entries(event.parser))); CreateMessageHook(AuthenticationEvent, event => handleAuthentication(Object.entries(event.parser)));
const handleAuthentication = useCallback((data: any) =>
{
setIsLoading(false);
if(!data) return;
let ssoFieldName = 'sso';
if(GetConfiguration<boolean>('auth.system.http.enabled')) ssoFieldName = GetConfiguration<string>('auth.system.sso_field_name', 'sso');
if(!data[ssoFieldName]) return;
window.location.href = window.location.origin + '/?sso=' + data[ssoFieldName];
}, []);
const sendAuthentication = useCallback(() => const sendAuthentication = useCallback(() =>
{ {
const recaptchaFieldName = GetConfiguration<string>('auth.system.recaptcha.field_name'); const recaptchaFieldName = GetConfiguration<string>('auth.system.recaptcha.field_name');
@ -137,7 +137,7 @@ export const AuthView: FC<AuthViewProps> = props =>
{ {
sendPacketAuthentication(requestKeys, requestValues); sendPacketAuthentication(requestKeys, requestValues);
} }
}, [ fields, recaptchaPublicKey, recaptchaAnswer ]); }, [recaptchaPublicKey, recaptchaAnswer, fields, sendHttpAuthentication, sendPacketAuthentication]);
const handleAction = useCallback((action: string, value?: string) => const handleAction = useCallback((action: string, value?: string) =>
{ {
@ -155,7 +155,7 @@ export const AuthView: FC<AuthViewProps> = props =>
sendAuthentication(); sendAuthentication();
return; return;
} }
}, [ fields, recaptchaAnswer ]); }, [sendAuthentication]);
if(!fields) return null; if(!fields) return null;