@@ -2,6 +2,7 @@ import { useLocation, useRouteError } from "react-router";
|
||||
import { IconPageCross } from "@probo/ui";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { AuthenticationRequiredError } from "/providers/RelayProviders";
|
||||
|
||||
const classNames = {
|
||||
wrapper: "py-10 text-center space-y-2 ",
|
||||
@@ -32,6 +33,27 @@ export function PageError({ resetErrorBoundary, error: propsError }: Props) {
|
||||
}
|
||||
}, [location, resetErrorBoundary]);
|
||||
|
||||
useEffect(() => {
|
||||
if (error instanceof AuthenticationRequiredError) {
|
||||
window.location.href = error.redirectUrl;
|
||||
}
|
||||
}, [error]);
|
||||
|
||||
if (error instanceof AuthenticationRequiredError) {
|
||||
return (
|
||||
<div className={classNames.wrapper}>
|
||||
<h1 className={classNames.title}>
|
||||
{__("Additional authentication required")}
|
||||
</h1>
|
||||
<p className={classNames.description}>
|
||||
{error.requiresSaml
|
||||
? __("Redirecting to SAML authentication...")
|
||||
: __("Redirecting to login...")}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!error || (error && error.toString().includes("PAGE_NOT_FOUND"))) {
|
||||
return (
|
||||
<div className={classNames.wrapper}>
|
||||
|
||||
Reference in New Issue
Block a user