import React from 'react'; import superagent from 'superagent'; import { Segment, Table, Message, Loader, Label } from 'semantic-ui-react'; /** * Lists user grants for a given OAuth client. Empty in Phase A (no OAuth flow * yet to produce grants); ships alongside so the detail page layout is stable. */ export default class OAuthGrantsList extends React.Component { constructor(props) { super(props); this.state = { loading: true, grants: [], error: null }; } async componentDidMount() { if (!this.props.uniqueId) return; try { const res = await superagent .get(`/api/admin/oauth/clients/${this.props.uniqueId}/grants`) .accept('json'); this.setState({ grants: res.body.grants || [], loading: false }); } catch (e) { this.setState({ error: e.response?.body?.message || e.message, loading: false }); } } render() { const { loading, grants, error } = this.state; if (loading) return Loading grants…; if (error) return {error}; if (grants.length === 0) { return ( No grants yet

User grants appear here once Phase B (authorize + consent) ships and real users start authorizing this client.

); } return ( User Scopes Granted Status {grants.map(g => ( {g.userId} {(g.scopes || []).map(s => ( ))} {new Date(g.grantedAt).toLocaleString()} {g.revokedAt ? : } ))}
); } }