fix(routing): fix store login 404 caused by CMS catch-all route priority

The CMS catch-all route /{store_code}/{slug} was registered before tenancy's
/{store_code}/login because modules are discovered alphabetically (cms before
tenancy). Also fix login.js store code extraction for /platforms/{code}/store/...
URL pattern.

- Add ROUTE_CONFIG priority=100 to CMS store pages so catch-all registers last
- Sort get_store_page_routes() by priority (matching other route getters)
- Use indexOf('store') in login.js to support platform-prefixed URLs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 20:30:16 +01:00
parent 55751d95b9
commit 7feacd5af8
3 changed files with 21 additions and 5 deletions

View File

@@ -22,6 +22,11 @@ logger = logging.getLogger(__name__)
router = APIRouter()
# Route configuration - high priority so catch-all is registered last
ROUTE_CONFIG = {
"priority": 100,
}
# ============================================================================
# HELPER: Build Store Dashboard Context
@@ -176,11 +181,13 @@ async def store_content_page(
)
store = getattr(request.state, "store", None)
platform = getattr(request.state, "platform", None)
store_id = store.id if store else None
platform_id = platform.id if platform else 1
# Load content page from database (store override → platform default)
page = content_page_service.get_page_for_store(
db, slug=slug, store_id=store_id, include_unpublished=False
db, platform_id=platform_id, slug=slug, store_id=store_id, include_unpublished=False
)
if not page: