Fix: Redirect business users from platform subdomain to their business subdomain

When a business user (owner, staff, resource) ended up on the platform
subdomain (e.g., via stale tokens or direct URL access), they would fall
through to business routes and see the PublicPage ("Schedule Your Appointment")
instead of being redirected to their proper business subdomain.

Added redirect rule for business users on platform subdomain to redirect
them to their business subdomain, matching the existing behavior for
customers on platform subdomain.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
poduck
2025-12-20 11:47:22 -05:00
parent 30701cddfb
commit a8d176b4ec

View File

@@ -463,6 +463,13 @@ const AppContent: React.FC = () => {
return <LoadingScreen />;
}
// RULE: Business users on platform subdomain should be redirected to their business subdomain
if (isBusinessUser && isPlatformDomain && user.business_subdomain) {
const port = window.location.port ? `:${window.location.port}` : '';
window.location.href = `${protocol}//${user.business_subdomain}.${baseDomain}${port}/`;
return <LoadingScreen />;
}
// RULE: Business users must be on their own business subdomain
if (isBusinessUser && isBusinessSubdomain && user.business_subdomain && user.business_subdomain !== currentSubdomain) {
const port = window.location.port ? `:${window.location.port}` : '';