| 1 |
import create from 'zustand' |
| 2 |
import { devtools, persist } from 'zustand/middleware' |
| 3 |
|
| 4 |
const store = (set) => ({ |
| 5 |
generating: false, |
| 6 |
orderId: null, |
| 7 |
setOrderId(orderId) { |
| 8 |
set({ orderId }) |
| 9 |
}, |
| 10 |
}) |
| 11 |
const withDevtools = devtools(store, { name: 'Extendify Launch Globals' }) |
| 12 |
const withPersist = persist(withDevtools, { |
| 13 |
name: 'extendify-launch-globals', |
| 14 |
getStorage: () => localStorage, |
| 15 |
partialize: (state) => ({ |
| 16 |
orderId: state?.orderId ?? null, |
| 17 |
}), |
| 18 |
}) |
| 19 |
export const useGlobalStore = create(withPersist) |
| 20 |
|