fix: more rabbit nitpicks

This commit is contained in:
Stavros
2026-02-01 00:16:58 +02:00
parent 01e491c3be
commit 673f556fb3
6 changed files with 27 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ import {
CardFooter,
CardContent,
} from "@/components/ui/card";
import { getOidcClientInfoScehma } from "@/schemas/oidc-schemas";
import { getOidcClientInfoSchema } from "@/schemas/oidc-schemas";
import { Button } from "@/components/ui/button";
import axios from "axios";
import { toast } from "sonner";
@@ -73,13 +73,13 @@ export const AuthorizePage = () => {
isOidc,
compiled: compiledOIDCParams,
} = useOIDCParams(searchParams);
const scopes = props.scope.split(" ");
const scopes = props.scope ? props.scope.split(" ").filter(Boolean) : [];
const getClientInfo = useQuery({
queryKey: ["client", props.client_id],
queryFn: async () => {
const res = await fetch(`/api/oidc/clients/${props.client_id}`);
const data = await getOidcClientInfoScehma.parseAsync(await res.json());
const data = await getOidcClientInfoSchema.parseAsync(await res.json());
return data;
},
enabled: isOidc,

View File

@@ -149,6 +149,10 @@ export const LoginPage = () => {
[],
);
if (isLoggedIn && isOidc) {
return <Navigate to={`/authorize?${compiledOIDCParams}`} replace />;
}
if (isLoggedIn && props.redirect_uri !== "") {
return (
<Navigate

View File

@@ -1,5 +1,5 @@
import { z } from "zod";
export const getOidcClientInfoScehma = z.object({
export const getOidcClientInfoSchema = z.object({
name: z.string(),
});