fusero-app-boilerplate/frontend/src/state/stores/useSystemStore.ts
2025-04-30 17:34:49 +02:00

31 lines
772 B
TypeScript

// Adjusting the store to handle SystemDropdownOption properly
import { create } from 'zustand';
import { Enterprise } from '../../components/SystemSelectionModal';
export type System = {
id: number;
name: string;
logo: string;
};
export type SystemDropdownOption = {
id: number;
label: string;
businessLabel: string;
urlSlug: string;
logo: string;
enterprises?: Enterprise[];
};
type SystemStore = {
currentSystem: SystemDropdownOption | null;
setSystem: (system: SystemDropdownOption) => void;
clearSystem: () => void;
};
export const useSystemStore = create<SystemStore>((set) => ({
currentSystem: null,
setSystem: (system: SystemDropdownOption) => set({ currentSystem: system }),
clearSystem: () => set({ currentSystem: null }),
}));