feat: finalize logic

This commit is contained in:
Stavros
2025-01-30 17:11:31 +02:00
parent 6602e8140b
commit 29f0a94faf
5 changed files with 98 additions and 33 deletions

View File

@@ -1,18 +1,12 @@
import { Button, Code, Paper, Text } from "@mantine/core";
import { Layout } from "../components/layouts/layout";
import { useUserContext } from "../context/user-context";
import { Navigate } from "react-router";
export const UnauthorizedPage = () => {
const queryString = window.location.search;
const params = new URLSearchParams(queryString);
const username = params.get("username");
const { isLoggedIn } = useUserContext();
if (isLoggedIn) {
return <Navigate to="/" />;
}
const resource = params.get("resource");
if (username === "null") {
return <Navigate to="/" />;
@@ -25,8 +19,14 @@ export const UnauthorizedPage = () => {
Unauthorized
</Text>
<Text>
The user with username <Code>{username}</Code> is not authorized to
login.
The user with username <Code>{username}</Code> is not authorized to{" "}
{resource !== "null" ? (
<span>
access the <Code>{resource}</Code> resource.
</span>
) : (
"login."
)}
</Text>
<Button
fullWidth