-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
severity|highThe related issue causes to consume too much resourcesThe related issue causes to consume too much resourcestype|bugSomething isn't workingSomething isn't working
Description
Something is causing it to rerender infinitely. This is a sample:
type AuthenticationGuardProps = {
required?: boolean;
redirect?: string;
};
const AuthenticationGuard: FC<AuthenticationGuardProps & ChildrenProps> = ({
required = false,
redirect,
children,
}) => {
const deviceState = useContext(DeviceContext);
const auth = useContext(FirebaseAuthContext)!;
console.log(auth.currentUser);
return (
<AuthorizationZone
auth={auth}
validator={
required
? Validators.isAuthenticated(false)
: Validators.isAnonymous(false)
}
onSuccess={() => children}
onFailure={() => {
if (redirect) {
return <Navigate to={redirect} />;
} else {
captureException({
message: "Attempt to unauthenticated access",
location: window.location.href,
ip: deviceState.state === "ready" ? deviceState.ip : null,
userAgent:
deviceState.state === "ready" ? deviceState.userAgent : null,
});
return "Bu sayfaya erişiminiz yok. Unauthorized access.";
}
}}
/>
);
};Metadata
Metadata
Assignees
Labels
severity|highThe related issue causes to consume too much resourcesThe related issue causes to consume too much resourcestype|bugSomething isn't workingSomething isn't working