Skip to content

Commit 5e54e35

Browse files
authored
Merge pull request #767 from trycompai/main
[comp] Production Deploy
2 parents b1f7090 + 41ffdf7 commit 5e54e35

3 files changed

Lines changed: 32 additions & 21 deletions

File tree

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/components/OnboardingTracker.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ export const OnboardingTracker = ({
242242
}
243243
};
244244

245+
if (run?.status === "COMPLETED") {
246+
return null;
247+
}
248+
245249
return (
246250
<Card className="w-full overflow-hidden rounded-none border-x-0 border-t-0">
247251
<CardContent className="flex flex-col items-center justify-center bg-background">

apps/app/src/app/api/revalidate/path/route.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export async function POST(request: NextRequest) {
66
try {
77
const { path, type, secret } = await request.json();
88

9+
console.log("Revalidating path from API: ", path);
10+
911
if (secret !== env.REVALIDATION_SECRET) {
1012
return NextResponse.json(
1113
{ message: "Invalid secret" },

apps/app/src/jobs/tasks/onboarding/onboard-organization.ts

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import ky from "ky";
1414
import z from "zod";
1515
import { researchVendor } from "../scrape/research";
1616
import { updatePolicies } from "./update-policies";
17+
import axios from "axios";
1718

1819
export const onboardOrganization = task({
1920
id: "onboard-organization",
@@ -25,6 +26,31 @@ export const onboardOrganization = task({
2526
},
2627
data: { triggerJobId: null },
2728
});
29+
30+
try {
31+
logger.info(
32+
`Revalidating path ${process.env.BETTER_AUTH_URL}/${organizationId}`,
33+
);
34+
const revalidateResponse = await axios.post(
35+
`${process.env.BETTER_AUTH_URL}/api/revalidate/path`,
36+
{
37+
path: `${process.env.BETTER_AUTH_URL}/${organizationId}`,
38+
secret: process.env.REVALIDATION_SECRET,
39+
type: "layout",
40+
},
41+
);
42+
43+
if (!revalidateResponse.data?.revalidated) {
44+
logger.error(
45+
`Failed to revalidate path: ${revalidateResponse.statusText}`,
46+
);
47+
logger.error(revalidateResponse.data);
48+
} else {
49+
logger.info("Revalidated path successfully");
50+
}
51+
} catch (err) {
52+
logger.error("Error revalidating path", { err });
53+
}
2854
},
2955
run: async (payload: {
3056
organizationId: string;
@@ -243,27 +269,6 @@ export const onboardOrganization = task({
243269
data: { completed: true },
244270
});
245271

246-
try {
247-
const revalidateResponse = await ky.post(
248-
`${process.env.BETTER_AUTH_URL}/api/revalidate/path`,
249-
{
250-
json: {
251-
path: `/${payload.organizationId}`,
252-
secret: process.env.REVALIDATION_SECRET,
253-
},
254-
},
255-
);
256-
257-
if (!revalidateResponse.ok) {
258-
logger.error(
259-
`Failed to revalidate path: ${revalidateResponse.statusText}`,
260-
);
261-
logger.error(await revalidateResponse.json());
262-
}
263-
} catch (err) {
264-
logger.error("Error revalidating path", { err });
265-
}
266-
267272
logger.info(`Created ${extractRisks.object.risks.length} risks`);
268273
logger.info(`Created ${extractVendors.object.vendors.length} vendors`);
269274
},

0 commit comments

Comments
 (0)