import { useMutation, useQuery } from "@tanstack/react-query"; import { ArrowLeft, ChevronLeft, ChevronRight, Filter, Search, } from "lucide-react"; import { useState } from "react"; import { Link, useParams } from "react-router-dom"; import { Badge } from "../../components/ui/badge"; import { Button } from "../../components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "../../components/ui/card"; import { Input } from "../../components/ui/input"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "../../components/ui/table"; import { fetchClient, fetchConsents, revokeConsent } from "../../lib/devApi"; function ClientConsentsPage() { const params = useParams(); const clientId = params.id ?? ""; const [subjectInput, setSubjectInput] = useState(""); const [subject, setSubject] = useState(""); const { data: clientData } = useQuery({ queryKey: ["client", clientId], queryFn: () => fetchClient(clientId), enabled: clientId.length > 0, }); const { data: consentsData, isLoading, error, refetch, } = useQuery({ queryKey: ["consents", clientId, subject], queryFn: () => fetchConsents(subject, clientId), enabled: clientId.length > 0, // Removed subject.length > 0 check }); const revokeMutation = useMutation({ mutationFn: (payload: { subject: string }) => revokeConsent(payload.subject, clientId), onSuccess: () => { refetch(); }, }); const rows = consentsData?.items ?? []; return (
User Consent Grants
OIDC Relying Party 사용자 권한을 검토·관리합니다.
Showing {rows.length > 0 ? 1 : 0} to{" "} {rows.length} of{" "} {rows.length} users
Active Grants
Total Scopes Issued
Avg. Scopes per User