Skip to content

Commit f3cb6f5

Browse files
committed
fix: revert to original working environment variable pattern
1 parent 89744c0 commit f3cb6f5

File tree

1 file changed

+22
-20
lines changed
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/apis

1 file changed

+22
-20
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/apis/feedback.ts

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import { z } from "zod";
2-
import {
3-
NEXT_PUBLIC_DASHBOARD_CLIENT_ID,
4-
NEXT_PUBLIC_THIRDWEB_API_HOST,
5-
} from "@/constants/public-envs";
62
import { getVercelEnv } from "@/utils/vercel";
73

84
type SupportFeedbackInput = {
@@ -31,26 +27,32 @@ export async function submitSupportFeedback(
3127
const input = parsed.data;
3228

3329
try {
34-
// Use fallback client ID if not configured (following codebase pattern)
35-
const clientId = NEXT_PUBLIC_DASHBOARD_CLIENT_ID || "dummy-build-client";
30+
const apiKey = process.env.NEXT_PUBLIC_DASHBOARD_CLIENT_ID;
31+
if (!apiKey) {
32+
return { error: "NEXT_PUBLIC_DASHBOARD_CLIENT_ID not configured" };
33+
}
34+
35+
// Use the main API host, not SIWA
36+
const apiHost = process.env.NEXT_PUBLIC_THIRDWEB_API_HOST;
37+
if (!apiHost) {
38+
return { error: "NEXT_PUBLIC_THIRDWEB_API_HOST not configured" };
39+
}
40+
3641
const vercelEnv = getVercelEnv();
3742
const isPreview = vercelEnv === "preview" || vercelEnv === "development";
3843

39-
const response = await fetch(
40-
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/csat/saveCSATFeedback`,
41-
{
42-
method: "POST",
43-
headers: {
44-
"Content-Type": "application/json",
45-
"x-service-api-key": clientId,
46-
},
47-
body: JSON.stringify({
48-
rating: input.rating,
49-
feedback: input.feedback,
50-
ticket_id: input.ticketId,
51-
}),
44+
const response = await fetch(`${apiHost}/v1/csat/saveCSATFeedback`, {
45+
method: "POST",
46+
headers: {
47+
"Content-Type": "application/json",
48+
"x-service-api-key": apiKey,
5249
},
53-
);
50+
body: JSON.stringify({
51+
rating: input.rating,
52+
feedback: input.feedback,
53+
ticket_id: input.ticketId,
54+
}),
55+
});
5456

5557
if (!response.ok) {
5658
if (response.status === 404 && isPreview) {

0 commit comments

Comments
 (0)