fix(twenty-front): error on captcha initialisation (#11039)
This commit is contained in:
@ -24,6 +24,7 @@ import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
|
||||
import { usePageChangeEffectNavigateLocation } from '~/hooks/usePageChangeEffectNavigateLocation';
|
||||
import { isCaptchaRequiredForPath } from '@/captcha/utils/isCaptchaRequiredForPath';
|
||||
|
||||
// TODO: break down into smaller functions and / or hooks
|
||||
// - moved usePageChangeEffectNavigateLocation into dedicated hook
|
||||
@ -178,15 +179,10 @@ export const PageChangeEffect = () => {
|
||||
const isCaptchaScriptLoaded = useRecoilValue(isCaptchaScriptLoadedState);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
isCaptchaScriptLoaded &&
|
||||
(isMatchingLocation(AppPath.SignInUp) ||
|
||||
isMatchingLocation(AppPath.Invite) ||
|
||||
isMatchingLocation(AppPath.ResetPassword))
|
||||
) {
|
||||
if (isCaptchaScriptLoaded && isCaptchaRequiredForPath(location.pathname)) {
|
||||
requestFreshCaptchaToken();
|
||||
}
|
||||
}, [isCaptchaScriptLoaded, isMatchingLocation, requestFreshCaptchaToken]);
|
||||
}, [isCaptchaScriptLoaded, location.pathname, requestFreshCaptchaToken]);
|
||||
|
||||
return <></>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user