Files
HoruxDespachos/apps/web/stores/tenant-view-store.ts
2026-04-27 22:09:36 -06:00

26 lines
821 B
TypeScript

import { create } from 'zustand';
import { persist } from 'zustand/middleware';
interface TenantViewState {
viewingTenantId: string | null;
viewingTenantName: string | null;
viewingTenantRfc: string | null;
setViewingTenant: (id: string | null, name: string | null, rfc?: string | null) => void;
clearViewingTenant: () => void;
}
export const useTenantViewStore = create<TenantViewState>()(
persist(
(set) => ({
viewingTenantId: null,
viewingTenantName: null,
viewingTenantRfc: null,
setViewingTenant: (id, name, rfc = null) => set({ viewingTenantId: id, viewingTenantName: name, viewingTenantRfc: rfc }),
clearViewingTenant: () => set({ viewingTenantId: null, viewingTenantName: null, viewingTenantRfc: null }),
}),
{
name: 'horux-tenant-view',
}
)
);