diff --git a/back/src/oidc-client/oidc-client.controller.ts b/back/src/oidc-client/oidc-client.controller.ts index 9d4b3b8..dee1e70 100644 --- a/back/src/oidc-client/oidc-client.controller.ts +++ b/back/src/oidc-client/oidc-client.controller.ts @@ -20,6 +20,7 @@ export class OidcClientController { async findAll() { return [ { + id: 123, clientDescription: 'Description', clientId: 'clientId', clientSecret: 'ClientSecret', @@ -34,6 +35,7 @@ export class OidcClientController { @Get('/:id') async find_by_id(@Param('id') id: string) { return { + id: 123, clientDescription: 'Description', clientId: 'clientId', clientSecret: 'ClientSecret', @@ -57,7 +59,7 @@ export class OidcClientController { HttpStatus.BAD_REQUEST, { cause: error, - } + }, ); } } diff --git a/back/src/oidc-client/oidc-client.dto.ts b/back/src/oidc-client/oidc-client.dto.ts index 2912918..cf353dd 100644 --- a/back/src/oidc-client/oidc-client.dto.ts +++ b/back/src/oidc-client/oidc-client.dto.ts @@ -3,6 +3,9 @@ import { IsNotEmpty } from 'class-validator'; export class CreateOidcClientDto { clientDescription: string | null; + @IsNotEmpty() + id: number; + @IsNotEmpty() clientName: string; diff --git a/front/src/providers/connectedSpaces/Dashboard.tsx b/front/src/providers/connectedSpaces/Dashboard.tsx index b4bfb18..ac3abac 100644 --- a/front/src/providers/connectedSpaces/Dashboard.tsx +++ b/front/src/providers/connectedSpaces/Dashboard.tsx @@ -1,61 +1,40 @@ import { Badge } from '@codegouvfr/react-dsfr/Badge'; import Title1 from '../../titles/Title1'; import { Card } from '@codegouvfr/react-dsfr/Card'; +import { useRouteLoaderData } from 'react-router-dom'; export const Dashboard = () => { + const oidcClients = useRouteLoaderData('dashboard'); return (
Tableau de bord
-
- -
  • - Clés de test - DINUM -
  • - - } - title="Test" - titleAs="h2" - /> -
    - - {/* CARTE 2 !! */} - -
    - -
  • - Clés de test - ANCT -
  • - - } - title="Test" - titleAs="h2" - /> -
    + {/* ERREUR DE TYPAGE A CORRIGER */} + {oidcClients.map((oidcClient) => ( +
    + +
  • + Clés de test + DINUM +
  • + + } + title={oidcClient.clientName} + titleAs="h2" + /> +
    + ))}
    ); diff --git a/front/src/routes/Router.tsx b/front/src/routes/Router.tsx index f0c156f..acc9c61 100644 --- a/front/src/routes/Router.tsx +++ b/front/src/routes/Router.tsx @@ -11,6 +11,7 @@ import { ProviderDetails } from '../providers/details/ProviderDetails'; import { OidcClientFormProvider } from '../providers/details/oidc-client-form.context'; import { EspaceDocumentation } from '../providers/documentation/EspaceDocumentation'; import { Dashboard } from '../providers/connectedSpaces/Dashboard'; +import { OidcClient } from '../types'; const router = createBrowserRouter([ { @@ -40,11 +41,13 @@ const router = createBrowserRouter([ { path: '/dashboard', loader: async () => { - return backendClient.getDashboard(); + const datas: OidcClient = await backendClient.getDashboard(); + return datas; }, + id: 'dashboard', element: ( - + ), }, diff --git a/front/src/types.ts b/front/src/types.ts index 3bb496f..dea509d 100644 --- a/front/src/types.ts +++ b/front/src/types.ts @@ -1,4 +1,5 @@ export type OidcClient = { + id: number; clientName: string; clientDescription: string; clientId: string; @@ -7,3 +8,5 @@ export type OidcClient = { postLogoutRedirectUris: string[]; scope: string[]; }; + +export type OidcClients = OidcClient[];