Skip to content

Commit

Permalink
fix: glitches in dirigeant useSession/getSession conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierJp committed May 17, 2024
1 parent 1219b17 commit 89738bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
13 changes: 7 additions & 6 deletions app/(header-default)/dirigeants/_component/sections/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ export async function DirigeantInformation({
uniteLegale: IUniteLegale;
session: ISession | null;
}) {
const [immatriculationRNE, mandatairesRCS] = await Promise.all([
getImmatriculationRNE(uniteLegale.siren),
hasRights(session, EScope.mandatairesRCS) &&
getMandatairesRCS(uniteLegale.siren, session?.user?.siret),
]);

if (
!estDiffusible(uniteLegale) &&
!hasRights(session, EScope.nonDiffusible)
) {
return <DonneesPriveesSection />;
}

const [immatriculationRNE, mandatairesRCS] = await Promise.all([
getImmatriculationRNE(uniteLegale.siren),
hasRights(session, EScope.mandatairesRCS) &&
getMandatairesRCS(uniteLegale.siren, session?.user?.siret),
]);

return (
<>
<DirigeantSummary
Expand Down
2 changes: 1 addition & 1 deletion clients/api-proxy/rne/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const fetchRNEImmatriculation = async (siren: Siren, useCache = true) =>
clientAPIProxy<IImmatriculationRNE>(
routes.proxy.rne.immatriculation + siren,
{
timeout: constants.timeout.XXXXL,
timeout: constants.timeout.XXXL,
useCache,
}
);
Expand Down
8 changes: 2 additions & 6 deletions components/unite-legale-page-link/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use client';

import { getNomComplet } from '#models/core/statut-diffusion';
import { IUniteLegale, isAssociation } from '#models/core/types';
import useSession from 'hooks/use-session';

type IProp = {
/**
Expand All @@ -20,11 +18,9 @@ type IProp = {
};

export function UniteLegalePageLink({ uniteLegale, href, siteName }: IProp) {
const session = useSession();
const nomComplet = getNomComplet(uniteLegale, session);
const linkLabel = isAssociation(uniteLegale)
? `la page de l’association ${nomComplet}`
: `la page de l’entreprise ${nomComplet}`;
? `la page de l’association`
: `la page de l’entreprise`;
const siteDescription = siteName ? ` sur ${siteName}` : '';
return (
<>
Expand Down

0 comments on commit 89738bb

Please sign in to comment.