"use client"; import { create } from "zustand"; import { Task } from "./lib"; import { Availability } from "./app/admin/(availabilities)/AvailabilityEditor"; export interface BaseEvent { eventID: number; date: string; description: string; } export type EventData = BaseEvent & { tasks: TaskAssignment[]; }; export interface TaskAssignment { taskID: number; taskName: string; userName: string | null; } export interface User { userName: string; admin: boolean; } export type UserAddModify = User & { password: string; }; interface Zustand { user: User | null; tasks?: Task[]; availabilities?: Availability[]; patch: (zustand?: Partial) => void; reset: (zustand?: Partial) => void; } const initialState = { user: null, }; const zustand = create()( // persist( (set, get) => ({ ...initialState, reset: (newZustand) => { set({ ...initialState, ...newZustand, }); }, patch: (patch) => set({ ...get(), ...patch }), }), // { // name: "golunteer-storage", // partialize: (state) => // Object.fromEntries( // Object.entries(state).filter(([key]) => // ["user", "tasksList", "tasksMap"].includes(key), // ), // ), // }, // ), ); export default zustand;