Skip to content

Commit b400065

Browse files
committed
chore: update endpoint to rotate secret key
1 parent dcd6b99 commit b400065

File tree

6 files changed

+21
-12
lines changed

6 files changed

+21
-12
lines changed

apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,14 @@ export type RotateSecretKeyAPIReturnType = {
322322
};
323323
};
324324

325-
export async function rotateSecretKeyClient(projectId: string) {
325+
export async function rotateSecretKeyClient(params: {
326+
teamId: string;
327+
projectId: string;
328+
}) {
326329
const res = await apiServerProxy<RotateSecretKeyAPIReturnType>({
327-
pathname: "/v2/keys/rotate-secret-key",
330+
pathname: `/v1/teams/${params.teamId}/projects/${params.projectId}/rotate-secret-key`,
328331
method: "POST",
329-
body: JSON.stringify({
330-
projectId,
331-
}),
332+
body: JSON.stringify({}),
332333
headers: {
333334
"Content-Type": "application/json",
334335
},

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/components/ProjectFTUX/ProjectFTUX.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function IntegrateAPIKeySection({
6363
{secretKeyMasked && (
6464
<SecretKeySection
6565
secretKeyMasked={secretKeyMasked}
66-
projectId={project.id}
66+
project={project}
6767
/>
6868
)}
6969
</div>

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/components/ProjectFTUX/SecretKeySection.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
"use client";
22

3+
import type { Project } from "@/api/projects";
34
import { rotateSecretKeyClient } from "@3rdweb-sdk/react/hooks/useApi";
45
import { useState } from "react";
56
import { RotateSecretKeyButton } from "../../settings/ProjectGeneralSettingsPage";
67

78
export function SecretKeySection(props: {
89
secretKeyMasked: string;
9-
projectId: string;
10+
project: Project;
1011
}) {
1112
const [secretKeyMasked, setSecretKeyMasked] = useState(props.secretKeyMasked);
1213

@@ -26,7 +27,10 @@ export function SecretKeySection(props: {
2627

2728
<RotateSecretKeyButton
2829
rotateSecretKey={async () => {
29-
return rotateSecretKeyClient(props.projectId);
30+
return rotateSecretKeyClient({
31+
teamId: props.project.teamId,
32+
projectId: props.project.id,
33+
});
3034
}}
3135
onSuccess={(data) => {
3236
setSecretKeyMasked(data.data.secretMasked);

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/nebula/nebula-ftux.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import type { Project } from "@/api/projects";
12
import { CodeServer } from "@/components/ui/code/code.server";
23
import { SecretKeySection } from "../components/ProjectFTUX/SecretKeySection";
34
import { WaitingForIntegrationCard } from "../components/WaitingForIntegrationCard/WaitingForIntegrationCard";
45

56
export function NebulaFTUX(props: {
67
secretKeyMasked: string;
7-
projectId: string;
8+
project: Project;
89
}) {
910
return (
1011
<WaitingForIntegrationCard
@@ -50,7 +51,7 @@ export function NebulaFTUX(props: {
5051
>
5152
<SecretKeySection
5253
secretKeyMasked={props.secretKeyMasked}
53-
projectId={props.projectId}
54+
project={props.project}
5455
/>
5556
<div className="h-4" />
5657
</WaitingForIntegrationCard>

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/nebula/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default async function Page(props: {
6060
<div className="container mt-6 max-w-7xl">
6161
<NebulaFTUX
6262
secretKeyMasked={project.secretKeys[0]?.masked || ""}
63-
projectId={project.id}
63+
project={project}
6464
/>
6565
</div>
6666
</div>

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/settings/ProjectGeneralSettingsPage.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ export function ProjectGeneralSettingsPage(props: {
165165
}}
166166
showNebulaSettings={props.showNebulaSettings}
167167
rotateSecretKey={async () => {
168-
return rotateSecretKeyClient(props.project.id);
168+
return rotateSecretKeyClient({
169+
teamId: props.project.teamId,
170+
projectId: props.project.id,
171+
});
169172
}}
170173
teamsWithRole={props.teamsWithRole}
171174
transferProject={async (newTeam) => {

0 commit comments

Comments
 (0)