ignore folder

This commit is contained in:
2026-04-21 06:30:48 +07:00
commit ca00b36f19
70 changed files with 3871 additions and 0 deletions

31
store/tenantStore.ts Normal file
View File

@ -0,0 +1,31 @@
import { create } from "zustand";
type TenantState = {
tenantId: string;
availableTenants: string[];
};
type TenantAction = {
setTenantId: (tenantId: string) => void;
hydrate: () => void;
};
const STORAGE_KEY = "utms-ng-tenant";
const fallbackTenants = ["acme", "global", "demo"];
export const useTenantStore = create<TenantState & TenantAction>((set, get) => ({
tenantId: process.env.NEXT_PUBLIC_DEFAULT_TENANT || "acme",
availableTenants: Array.from(
new Set([process.env.NEXT_PUBLIC_DEFAULT_TENANT || "acme", ...fallbackTenants])
),
setTenantId: (tenantId) => {
set({ tenantId });
if (typeof window !== "undefined") localStorage.setItem(STORAGE_KEY, tenantId);
},
hydrate: () => {
if (typeof window === "undefined") return;
const raw = localStorage.getItem(STORAGE_KEY);
if (raw) set({ tenantId: raw });
else set({ tenantId: get().tenantId });
}
}));