Skip to content

Commit

Permalink
fix: hot fix for syncOwnership
Browse files Browse the repository at this point in the history
  • Loading branch information
jonat75 committed Feb 9, 2024
1 parent 0ad56b7 commit 5f75314
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 7 additions & 2 deletions packages/app/src/api/core-domain/infra/auth/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { type MonCompteProProfile, MonCompteProProvider } from "@api/core-domain/infra/auth/MonCompteProProvider";
import { ownershipRepo } from "@api/core-domain/repo";
import { SyncOwnership } from "@api/core-domain/useCases/SyncOwnership";
import { logger } from "@api/utils/pino";
import { config } from "@common/config";
import { assertImpersonatedSession } from "@common/core-domain/helpers/impersonate";
import { Octokit } from "@octokit/rest";
Expand Down Expand Up @@ -147,8 +148,12 @@ export const authConfig: AuthOptions = {
} else {
const sirenList = profile?.organizations.map(orga => orga.siret.substring(0, 9));
if (profile?.email && sirenList) {
const useCase = new SyncOwnership(ownershipRepo);
await useCase.execute({ sirens: sirenList, email: profile.email });
try {
const useCase = new SyncOwnership(ownershipRepo);
await useCase.execute({ sirens: sirenList, email: profile.email });
} catch (error: unknown) {
logger.error("Error while syncing ownerships", error);
}
}
token.user.companies =
profile?.organizations.map(orga => ({
Expand Down
5 changes: 0 additions & 5 deletions packages/app/src/app/(default)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { authConfig } from "@api/core-domain/infra/auth/config";
import { logger } from "@api/utils/pino";
import Alert from "@codegouvfr/react-dsfr/Alert";
import { type NextServerPageProps } from "@common/utils/next";
import { Box, CenteredContainer } from "@design-system";
Expand Down Expand Up @@ -38,10 +37,6 @@ const LoginPage = async ({ searchParams }: NextServerPageProps<never, "callbackU
const callbackUrl = typeof searchParams.callbackUrl === "string" ? searchParams.callbackUrl : "";
const error = typeof searchParams.error === "string" ? searchParams.error : "";

logger.child({ callbackUrl }).info(`LoginPage, callbackUrl:`);
logger.child({ error }).info(`LoginPage, error:`);
logger.child({ authConfig }).info(`auth config`);

return (
<CenteredContainer py="6w">
<h1>{title}</h1>
Expand Down

0 comments on commit 5f75314

Please sign in to comment.