Skip to content

Commit 02ec2cc

Browse files
committed
fix: gate CSAT 404 fallback to non-production environments
1 parent cddce3e commit 02ec2cc

File tree

1 file changed

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

1 file changed

+6
-11
lines changed

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,17 @@ export async function submitSupportFeedback(
3636
});
3737

3838
if (!response.ok) {
39-
if (response.status === 404) {
40-
// CSAT endpoint doesn't exist in development, log locally
41-
console.log(
42-
"📝 CSAT endpoint not available in development, logging locally:",
39+
if (response.status === 404 && process.env.NODE_ENV !== "production") {
40+
// Only in non-prod, simulate success if the endpoint isn't deployed yet
41+
console.debug(
42+
"CSAT endpoint not available; treating as success in dev",
4343
{
4444
rating: data.rating,
45-
feedback: data.feedback,
4645
ticket_id: data.ticketId,
47-
timestamp: new Date().toISOString(),
48-
environment: "development",
46+
env: process.env.NODE_ENV,
4947
},
5048
);
51-
52-
// Simulate API delay
53-
await new Promise((resolve) => setTimeout(resolve, 500));
54-
49+
await new Promise((resolve) => setTimeout(resolve, 300));
5550
return { success: true };
5651
}
5752

0 commit comments

Comments
 (0)