import { create } from "zustand";
import { persist } from "zustand/middleware";
// import { IUser } from "../types/IUser";

interface State {
  token: string | null;
  setToken: (token: string | null) => void;
  // user: IUser | null;
  // setUser: (user: IUser | null) => void;
}

const useAuthStore = create<State>()(
  persist(
    (set) => ({
      token: null,
      setToken: (token) => set({ token }),
      // user: null,
      // setUser: (user) => set({ user }),
    }),
    {
      name: "auth", // name of the item in the storage (must be unique)
    }
  )
);

export default useAuthStore;
