Initial commit: Horux Despachos project
This commit is contained in:
25
apps/web/stores/tenant-view-store.ts
Normal file
25
apps/web/stores/tenant-view-store.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
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',
|
||||
}
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user