Skip to content

Commit

Permalink
fix: mpc refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
jonat75 committed Jul 22, 2024
1 parent 9a48ff2 commit d4f5c53
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/app/src/app/(default)/login/MonCompteProLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const MonCompteProLogin = ({ callbackUrl }: MonCompteProLoginProps) => (
<MonCompteProButton
onClick={e => {
e.preventDefault();
signIn("moncomptepro", { callbackUrl });
signIn("moncomptepro", { callbackUrl, redirect: true });
}}
/>
<Link href="/aide-moncomptepro" target="_blank">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { authConfig } from "@api/core-domain/infra/auth/config";
import Alert from "@codegouvfr/react-dsfr/Alert";
import { config } from "@common/config";
import { type DeclarationDTO } from "@common/core-domain/dtos/DeclarationDTO";
import { type DeclarationOpmcDTO } from "@common/core-domain/dtos/DeclarationOpmcDTO";
import { type RepresentationEquilibreeDTO } from "@common/core-domain/dtos/RepresentationEquilibreeDTO";
Expand Down Expand Up @@ -71,7 +72,14 @@ const MesDeclarationsPage = async ({ searchParams }: NextServerPageProps<never,
<p>
<br />
Vous souhaitez rattacher votre adresse mail à un autre Siren,{" "}
<Link href="https://app.moncomptepro.beta.gouv.fr/manage-organizations">cliquez ici</Link>
<Link
target="_blank"
href={`https://app${
config.api.security.moncomptepro.appTest ? "-sandbox" : ""
}.moncomptepro.beta.gouv.fr/manage-organizations`}
>
cliquez ici
</Link>
</p>
</Box>
</MessageProvider>
Expand Down Expand Up @@ -114,7 +122,14 @@ const MesDeclarationsPage = async ({ searchParams }: NextServerPageProps<never,
<p>
<br />
Vous souhaitez rattacher votre adresse mail à un autre Siren,{" "}
<Link href="https://app.moncomptepro.beta.gouv.fr/manage-organizations">cliquez ici</Link>
<Link
target="_blank"
href={`https://app${
config.api.security.moncomptepro.appTest ? "-sandbox" : ""
}.moncomptepro.beta.gouv.fr/manage-organizations`}
>
cliquez ici
</Link>
</p>
</Box>
<Box mt="10w">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"use client";

import { fr } from "@codegouvfr/react-dsfr";
import { Button } from "@codegouvfr/react-dsfr/Button";
import { Select } from "@codegouvfr/react-dsfr/Select";
import { Grid, GridCol } from "@design-system";
import { getCompany } from "@globalActions/company";
import { useRouter } from "next/navigation";
import { signIn } from "next-auth/react";
import { useEffect, useState } from "react";

export const SelectSiren = ({ sirenList, loadedSiren }: { loadedSiren?: string; sirenList: string[] }) => {
Expand Down Expand Up @@ -42,6 +44,11 @@ export const SelectSiren = ({ sirenList, loadedSiren }: { loadedSiren?: string;
<span>{selectedCompanyName}</span>
</div>
</GridCol>
<Button
onClick={() => signIn("moncomptepro", { callbackUrl: `/mon-espace/mes-entreprises?siren=${currentSiren}` })}
>
Rafraichir MCP
</Button>
</Grid>
);
};
18 changes: 16 additions & 2 deletions packages/app/src/app/(default)/mon-espace/mes-entreprises/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,14 @@ const MesEntreprisesPage = async ({ searchParams }: NextServerPageProps<never, "
<p>
<br />
Vous souhaitez rattacher votre adresse mail à un autre Siren,{" "}
<Link href="https://app.moncomptepro.beta.gouv.fr/manage-organizations">cliquez ici</Link>
<Link
target="_blank"
href={`https://app${
config.api.security.moncomptepro.appTest ? "-sandbox" : ""
}.moncomptepro.beta.gouv.fr/manage-organizations`}
>
cliquez ici
</Link>
</p>
</Box>
{typeof selectedSiren === "string" && (
Expand All @@ -122,7 +129,14 @@ const MesEntreprisesPage = async ({ searchParams }: NextServerPageProps<never, "
<p>
<br />
Vous souhaitez rattacher votre adresse mail à un autre Siren,{" "}
<Link href="https://app.moncomptepro.beta.gouv.fr/manage-organizations">cliquez ici</Link>
<Link
target="_blank"
href={`https://app${
config.api.security.moncomptepro.appTest ? "-sandbox" : ""
}.moncomptepro.beta.gouv.fr/manage-organizations`}
>
cliquez ici
</Link>
</p>
</Box>
<Box mt="4w">Le siren fournit est invalide.</Box>
Expand Down

0 comments on commit d4f5c53

Please sign in to comment.