17 lines
489 B
TypeScript
17 lines
489 B
TypeScript
import { create } from "zustand"
|
|
import { mockNotifications } from "@/lib/mock"
|
|
import type { Notification } from "@/lib/types"
|
|
|
|
interface NotificationState {
|
|
notifications: Notification[]
|
|
markAllAsRead: () => void
|
|
}
|
|
|
|
export const useNotificationStore = create<NotificationState>((set) => ({
|
|
notifications: mockNotifications,
|
|
markAllAsRead: () =>
|
|
set((state) => ({
|
|
notifications: state.notifications.map((notification) => ({ ...notification, read: true })),
|
|
})),
|
|
}))
|