vehicle_store.tsx 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. import { create } from 'zustand';
  2. interface VehicleState {
  3. vehicleBrand: string;
  4. BrandID: string;
  5. vehicleModel: string;
  6. ModelID: string;
  7. licensePlate: string;
  8. setVehicleBrand: (brand: string) => void;
  9. setBrandID: (id: string) => void;
  10. setVehicleModel: (model: string) => void;
  11. setModelID: (id: string) => void;
  12. setLicensePlate: (plate: string) => void;
  13. }
  14. // Create the store
  15. const useVehicleStore = create<VehicleState>((set) => ({
  16. vehicleBrand: 'default',
  17. BrandID: '2a9a1d32-a7be-402a-b9a1-5d8203324bde',
  18. vehicleModel: 'default',
  19. ModelID: '2678ca64-8e21-4df9-954c-f38088849e46',
  20. licensePlate: '',
  21. setVehicleBrand: (brand: string) => set({ vehicleBrand: brand }),
  22. setBrandID: (id: string) => set({ BrandID: id }),
  23. setVehicleModel: (model: string) => set({ vehicleModel: model }),
  24. setModelID: (id: string) => set({ ModelID: id }),
  25. setLicensePlate: (plate: string) => set({ licensePlate: plate })
  26. }));
  27. export default useVehicleStore;