diff --git a/backend/app/api/endpoints/admin_survey.py b/backend/app/api/endpoints/admin_survey.py index f998b1e4..b6603a1b 100644 --- a/backend/app/api/endpoints/admin_survey.py +++ b/backend/app/api/endpoints/admin_survey.py @@ -29,11 +29,14 @@ logger = logging.getLogger(__name__) router = APIRouter(prefix="/admin", tags=["admin-survey"]) -FRONTEND_URL = "https://resolutionflow.com" +def _get_frontend_url() -> str: + if settings.FRONTEND_URL: + return settings.FRONTEND_URL + return "http://localhost:5173" if settings.DEBUG else "https://resolutionflow.com" def _build_invite_response(invite: SurveyInvite) -> SurveyInviteResponse: - base_url = FRONTEND_URL if not settings.DEBUG else "http://localhost:5173" + base_url = _get_frontend_url() return SurveyInviteResponse( id=str(invite.id), token=invite.token, @@ -63,7 +66,7 @@ async def create_survey_invite( if data.send_email and data.recipient_email: try: - base_url = FRONTEND_URL if not settings.DEBUG else "http://localhost:5173" + base_url = _get_frontend_url() survey_url = f"{base_url}/survey?t={invite.token}" sent = await EmailService.send_survey_invite_email( to_email=data.recipient_email,