fix: store tenant slug (not UUID) in current_tenant; remove plan trial periods

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-07 09:01:21 -08:00
parent 1e4aab378d
commit 149939f5f0
2 changed files with 7 additions and 5 deletions

View File

@ -34,10 +34,12 @@ export default function AdminLayout({ children }: { children: React.ReactNode })
const isPlatformAdmin = Array.isArray(user.roles) &&
(user.roles.includes('platform_admin') || user.roles.includes('platform_super_admin'));
if (!isPlatformAdmin) {
apiClient<{ id: string; name: string; plan: string }>('/api/v1/auth/my-org')
apiClient<{ id: string; slug: string; name: string; plan: string }>('/api/v1/auth/my-org')
.then((org) => {
setCurrentTenant({ id: org.id, name: org.name, plan: org.plan as any });
localStorage.setItem('current_tenant', JSON.stringify({ id: org.id, name: org.name, plan: org.plan }));
// Use slug as the tenant identifier (X-Tenant-Id header must be the slug, not UUID)
const tenantId = org.slug || org.id;
setCurrentTenant({ id: tenantId, name: org.name, plan: org.plan as any });
localStorage.setItem('current_tenant', JSON.stringify({ id: tenantId, name: org.name, plan: org.plan }));
})
.catch(() => { /* ignore — token may be expired */ });
}

View File

@ -29,7 +29,7 @@ const SEED_PLANS = [
maxUsers: 20,
maxStandingOrders: 100,
hardLimitPercent: 150,
trialDays: 14,
trialDays: 0,
isActive: true,
},
{
@ -44,7 +44,7 @@ const SEED_PLANS = [
maxUsers: -1,
maxStandingOrders: -1,
hardLimitPercent: 0, // no hard limit
trialDays: 14,
trialDays: 0,
isActive: true,
},
];