userinfo_store.tsx 667 B

123456789101112131415161718192021
  1. import { create } from 'zustand';
  2. interface UserInfoState {
  3. userID: string;
  4. currentPrice: number | string;
  5. notifySessionID: string;
  6. setUserID: (id: string) => void;
  7. setCurrentPrice: (price: number | string) => void;
  8. setNotifySessionID: (id: string) => void;
  9. }
  10. const useUserInfoStore = create<UserInfoState>((set) => ({
  11. userID: '',
  12. notifySessionID: '',
  13. currentPrice: 0,
  14. setUserID: (id: string) => set({ userID: id }),
  15. setNotifySessionID: (id: string) => set({ notifySessionID: id }),
  16. setCurrentPrice: (price: number | string) => set({ currentPrice: price })
  17. }));
  18. export default useUserInfoStore;