inogen/app/routes/unauthorized.tsx

26 lines
880 B
TypeScript

import type { Route } from "./+types/unauthorized";
import { Unauthorized, TokenExpiredUnauthorized, InsufficientPermissionsUnauthorized } from "~/components/common/unauthorized";
import { useSearchParams } from "react-router";
export function meta({}: Route.MetaArgs) {
return [
{ title: "دسترسی غیرمجاز - 403" },
{ name: "description", content: "شما دسترسی لازم برای این صفحه را ندارید" },
];
}
export default function UnauthorizedPage() {
const [searchParams] = useSearchParams();
const reason = searchParams.get("reason");
// Show different unauthorized pages based on the reason
switch (reason) {
case "token-expired":
return <TokenExpiredUnauthorized />;
case "insufficient-permissions":
return <InsufficientPermissionsUnauthorized />;
default:
return <Unauthorized />;
}
}