MCPcopy Create free account
hub / github.com/authorizerdev/authorizer / Users

Function Users

web/dashboard/src/pages/Users.tsx:73–574  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71const PAGE_SIZE_OPTIONS = [10, 25, 50];
72
73export default function Users() {
74 const client = useClient();
75 const [paginationProps, setPaginationProps] = React.useState<PaginationProps>(
76 {
77 limit: 10,
78 page: 1,
79 offset: 0,
80 total: 0,
81 maxPages: 1,
82 },
83 );
84 const [userList, setUserList] = React.useState<User[]>([]);
85 const [loading, setLoading] = React.useState<boolean>(false);
86 const [searchQuery, setSearchQuery] = React.useState('');
87 const [selectedUser, setSelectedUser] = React.useState<User | null>(null);
88 // User whose FGA permissions are being inspected (Users table → dropdown).
89 const [permissionsUser, setPermissionsUser] = React.useState<User | null>(
90 null,
91 );
92
93 const updateUserList = async () => {
94 setLoading(true);
95 const { data } = await client
96 .query<UsersResponse>(UserDetailsQuery, {
97 params: {
98 pagination: {
99 limit: paginationProps.limit,
100 page: paginationProps.page,
101 },
102 },
103 })
104 .toPromise();
105 if (data?._users) {
106 const { pagination, users } = data._users;
107 const maxPages = getMaxPages(pagination as unknown as PaginationProps);
108 if (users && users.length > 0) {
109 setPaginationProps({ ...paginationProps, ...pagination, maxPages });
110 setUserList(users);
111 } else {
112 if (paginationProps.page !== 1) {
113 setPaginationProps({
114 ...paginationProps,
115 ...pagination,
116 maxPages,
117 page: 1,
118 });
119 }
120 }
121 }
122 setLoading(false);
123 };
124
125 React.useEffect(() => {
126 updateUserList();
127 }, []);
128
129 React.useEffect(() => {
130 updateUserList();

Callers

nothing calls this directly

Calls 6

copyTextToClipboardFunction · 0.90
updateUserListFunction · 0.85
userVerificationHandlerFunction · 0.85
updateAccessHandlerFunction · 0.85
paginationHandlerFunction · 0.70

Tested by

no test coverage detected