feat: add multi-tenant client management for admins
- Add tenants API endpoints (list, get, create) - Add tenant middleware override via X-View-Tenant header - Add TenantSelector dropdown component in header - Add tenant view store with persistence - Add Clientes management page - Update all navigation layouts with Clientes link for admins Admins can now: - View list of all clients - Create new clients with automatic schema setup - Switch between viewing different clients' data - See which client they are currently viewing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
23
apps/web/stores/tenant-view-store.ts
Normal file
23
apps/web/stores/tenant-view-store.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { create } from 'zustand';
|
||||
import { persist } from 'zustand/middleware';
|
||||
|
||||
interface TenantViewState {
|
||||
viewingTenantId: string | null;
|
||||
viewingTenantName: string | null;
|
||||
setViewingTenant: (id: string | null, name: string | null) => void;
|
||||
clearViewingTenant: () => void;
|
||||
}
|
||||
|
||||
export const useTenantViewStore = create<TenantViewState>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
viewingTenantId: null,
|
||||
viewingTenantName: null,
|
||||
setViewingTenant: (id, name) => set({ viewingTenantId: id, viewingTenantName: name }),
|
||||
clearViewingTenant: () => set({ viewingTenantId: null, viewingTenantName: null }),
|
||||
}),
|
||||
{
|
||||
name: 'horux-tenant-view',
|
||||
}
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user