import { Button, Code, Paper, Text } from "@mantine/core";
import { Layout } from "../components/layouts/layout";
import { Navigate } from "react-router";
import { isQueryValid } from "../utils/utils";
import { Trans, useTranslation } from "react-i18next";
import React from "react";
export const UnauthorizedPage = () => {
const queryString = window.location.search;
const params = new URLSearchParams(queryString);
const username = params.get("username") ?? "";
const groupErr = params.get("groupErr") ?? "";
const resource = params.get("resource") ?? "";
const { t } = useTranslation();
if (!isQueryValid(username)) {
return ;
}
if (isQueryValid(resource) && !isQueryValid(groupErr)) {
return (
}}
values={{ resource, username }}
/>
);
}
if (isQueryValid(groupErr) && isQueryValid(resource)) {
return (
}}
values={{ username, resource }}
/>
)
}
return (
}}
values={{ username }}
/>
);
};
const UnauthorizedLayout = ({ children }: { children: React.ReactNode }) => {
const { t } = useTranslation();
return (
{t("Unauthorized")}
{children}
);
};