keep landing page independent from api

This commit is contained in:
Beverly Nguyen
2025-04-11 13:03:40 -07:00
parent d3e17c743b
commit 3e18c8f595
2 changed files with 27 additions and 6 deletions

View File

@@ -1,3 +1,5 @@
import logging
from flask import (
abort,
current_app,
@@ -19,6 +21,8 @@ from app.main.views.sub_navigation_dictionaries import (
)
from app.utils.user import user_is_logged_in
logger = logging.getLogger(__name__)
# Hook to check for feature flags
@main.before_request
@@ -42,10 +46,15 @@ def index():
if current_user and current_user.is_authenticated:
return redirect(url_for("main.choose_account"))
try:
counts = status_api_client.get_count_of_live_services_and_organizations()
except Exception as e:
logger.warning(f"API down when loading homepage: {e}")
counts = {"live_service_count": "N/A", "live_organization_count": "N/A"}
return render_template(
"views/signedout.html",
sms_rate=CURRENT_SMS_RATE,
counts=status_api_client.get_count_of_live_services_and_organizations(),
counts=counts,
)