import { create } from "zustand";
import { getVod } from "../api";

export const useMediaStore = create((set) => ({
  list: [],
  listFilter: [],
  setList: (newState: any) =>
    set(() => ({ list: newState, listFilter: newState })),
  useFilter: (keyword: string) =>
    set((state: any) => ({
      listFilter: !keyword
        ? state.list
        : state.list.filter(
            (i: any) => i.name.toUpperCase().indexOf(keyword.toUpperCase()) > -1
          ),
    })),
}));
