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) && const isPlatformAdmin = Array.isArray(user.roles) &&
(user.roles.includes('platform_admin') || user.roles.includes('platform_super_admin')); (user.roles.includes('platform_admin') || user.roles.includes('platform_super_admin'));
if (!isPlatformAdmin) { 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) => { .then((org) => {
setCurrentTenant({ id: org.id, name: org.name, plan: org.plan as any }); // Use slug as the tenant identifier (X-Tenant-Id header must be the slug, not UUID)
localStorage.setItem('current_tenant', JSON.stringify({ id: org.id, name: org.name, plan: org.plan })); 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 */ }); .catch(() => { /* ignore — token may be expired */ });
} }

View File

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