You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GHHub/src/stores/Form.js

18 lines
680 B
JavaScript

import { create } from 'zustand';
import { devtools } from 'zustand/middleware';
import { usingStorage } from '@/hooks/usingStorage'
export const useFormStore = create(
devtools((set, get) => ({
formValues: {},
setFormValues: (values) => set((state) => ({ formValues: { ...state.formValues, ...values } })),
formValuesToSub: { agency: usingStorage().travelAgencyId },
setFormValuesToSub: (values) => set((state) => ({ formValuesToSub: { ...state.formValuesToSub, ...values } })),
cache: {},
setCache: (values) => set((state) => ({ cache: { ...state.cache, ...values } })),
}), { name: 'formStore' })
);
export default useFormStore;