|
1 | 1 | import { z } from "zod"; |
| 2 | +import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs"; |
| 3 | +import { API_SERVER_SECRET } from "@/constants/server-envs"; |
2 | 4 | import { getVercelEnv } from "@/utils/vercel"; |
3 | 5 |
|
4 | 6 | type SupportFeedbackInput = { |
@@ -27,29 +29,29 @@ export async function submitSupportFeedback( |
27 | 29 | const input = parsed.data; |
28 | 30 |
|
29 | 31 | try { |
30 | | - const apiKey = process.env.NEXT_PUBLIC_DASHBOARD_CLIENT_ID; |
31 | | - if (!apiKey) { |
32 | | - return { error: "NEXT_PUBLIC_DASHBOARD_CLIENT_ID not configured" }; |
| 32 | + if (!API_SERVER_SECRET) { |
| 33 | + return { error: "API_SERVER_SECRET not configured" }; |
33 | 34 | } |
34 | 35 |
|
35 | | - // Use the main API host, not SIWA |
36 | | - const apiHost = process.env.NEXT_PUBLIC_THIRDWEB_API_HOST; |
37 | | - if (!apiHost) { |
| 36 | + if (!NEXT_PUBLIC_THIRDWEB_API_HOST) { |
38 | 37 | return { error: "NEXT_PUBLIC_THIRDWEB_API_HOST not configured" }; |
39 | 38 | } |
40 | 39 |
|
41 | | - const response = await fetch(`${apiHost}/v1/csat/saveCSATFeedback`, { |
42 | | - method: "POST", |
43 | | - headers: { |
44 | | - "Content-Type": "application/json", |
45 | | - "x-service-api-key": apiKey, |
| 40 | + const response = await fetch( |
| 41 | + `${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/csat/saveCSATFeedback`, |
| 42 | + { |
| 43 | + method: "POST", |
| 44 | + headers: { |
| 45 | + "Content-Type": "application/json", |
| 46 | + "x-service-api-key": API_SERVER_SECRET, |
| 47 | + }, |
| 48 | + body: JSON.stringify({ |
| 49 | + rating: input.rating, |
| 50 | + feedback: input.feedback, |
| 51 | + ticket_id: input.ticketId, |
| 52 | + }), |
46 | 53 | }, |
47 | | - body: JSON.stringify({ |
48 | | - rating: input.rating, |
49 | | - feedback: input.feedback, |
50 | | - ticket_id: input.ticketId, |
51 | | - }), |
52 | | - }); |
| 54 | + ); |
53 | 55 |
|
54 | 56 | if (!response.ok) { |
55 | 57 | // Check if we're in a preview environment (Vercel preview deployments) |
|
0 commit comments