File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/apis Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 11"use server" ;
22
3+ import { getVercelEnv } from "@/utils/vercel" ;
4+
35interface FeedbackData {
46 rating : number ;
57 feedback : string ;
@@ -36,14 +38,17 @@ export async function submitSupportFeedback(
3638 } ) ;
3739
3840 if ( ! response . ok ) {
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+ // Check if we're in a preview environment (Vercel preview deployments)
42+ const vercelEnv = getVercelEnv ( ) ;
43+ const isPreview = vercelEnv === "preview" || vercelEnv === "development" ;
44+ if ( response . status === 404 && isPreview ) {
45+ // Only in preview/dev, simulate success if the endpoint isn't deployed yet
4146 console . debug (
42- "CSAT endpoint not available; treating as success in dev" ,
47+ "CSAT endpoint not available; treating as success in preview/ dev" ,
4348 {
4449 rating : data . rating ,
4550 ticket_id : data . ticketId ,
46- env : process . env . NODE_ENV ,
51+ vercel_env : vercelEnv ,
4752 } ,
4853 ) ;
4954 await new Promise ( ( resolve ) => setTimeout ( resolve , 300 ) ) ;
You can’t perform that action at this time.
0 commit comments