diff --git a/apps/web/components/shared/SurveyStatusIndicator.tsx b/apps/web/components/shared/SurveyStatusIndicator.tsx
index 819593351f..d29c82261e 100644
--- a/apps/web/components/shared/SurveyStatusIndicator.tsx
+++ b/apps/web/components/shared/SurveyStatusIndicator.tsx
@@ -58,7 +58,7 @@ export default function SurveyStatusIndicator({
>
) : status === "paused" ? (
<>
-
Survey paused.
+
Survey paused.
diff --git a/apps/web/pages/api/v1/client/surveys/[surveyId]/index.ts b/apps/web/pages/api/v1/client/surveys/[surveyId]/index.ts
index 96dd7d73c3..30b631379b 100644
--- a/apps/web/pages/api/v1/client/surveys/[surveyId]/index.ts
+++ b/apps/web/pages/api/v1/client/surveys/[surveyId]/index.ts
@@ -19,13 +19,14 @@ export default async function handle(req: NextApiRequest, res: NextApiResponse)
where: {
id: surveyId,
type: "link",
- status: "inProgress",
+ // status: "inProgress",
},
select: {
id: true,
questions: true,
thankYouCard: true,
environmentId: true,
+ status: true,
},
});
@@ -48,6 +49,12 @@ export default async function handle(req: NextApiRequest, res: NextApiResponse)
},
});
+ if (survey.status !== "inProgress") {
+ return res
+ .status(403)
+ .json({ message: "Survey not running", reason: survey.status, brandColor: product?.brandColor });
+ }
+
// if survey exists, return survey
return res.status(200).json({ ...survey, brandColor: product?.brandColor });
}