keycloak-scim/src/App.tsx

29 lines
943 B
TypeScript
Raw Normal View History

import React, { useContext } from 'react';
import { ClientList } from './clients/ClientList';
import { DataLoader } from './components/data-loader/DataLoader';
import { HttpClientContext } from './http-service/HttpClientContext';
import { Client } from './clients/client-model';
2020-08-08 13:52:23 +00:00
import { Page, PageSection } from '@patternfly/react-core';
import { Header } from './PageHeader';
import { PageNav } from './PageNav';
2020-08-08 13:52:23 +00:00
export const App = () => {
const httpClient = useContext(HttpClientContext);
const loader = async () => {
return await httpClient
?.doGet('/realms/master/clients?first=0&max=20&search=true')
.then((r) => r.data as Client[]);
};
return (
2020-08-21 00:09:05 +00:00
<Page header={<Header />} isManagedSidebar sidebar={<PageNav />}>
<PageSection variant="light">
2020-08-06 09:43:33 +00:00
<DataLoader loader={loader}>
{(clients) => <ClientList clients={clients} />}
</DataLoader>
</PageSection>
</Page>
);
};