mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-02-04 04:30:06 +00:00
19 lines
645 B
TypeScript
19 lines
645 B
TypeScript
import { NotificationStore } from '@/types'
|
|
import { create } from 'zustand'
|
|
import { persist, createJSONStorage } from 'zustand/middleware'
|
|
|
|
export const useNotificationStore = create<NotificationStore, [['zustand/persist', NotificationStore]]>(
|
|
persist(
|
|
(set, get) => ({
|
|
notifiers: get()?.notifiers,
|
|
notifierGroup: get()?.notifierGroup,
|
|
setNotifier: notifiers => set({ notifiers }),
|
|
setNotifierGroup: notifierGroup => set({ notifierGroup }),
|
|
}),
|
|
{
|
|
name: 'notificationStore',
|
|
storage: createJSONStorage(() => localStorage),
|
|
},
|
|
),
|
|
)
|