summaryrefslogtreecommitdiff
path: root/src/common/stores/useResultStore.ts
blob: d8da56c6742e7fe73b2fca8e9ede10a7135a17da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { create } from "zustand";

type State = {
  filter: {
    search: string;
    company: string;
  };
};

type Action = {
  updateFilter: (name: string, value: string) => void;
};

export const useResultStore = create<State & Action>((set) => ({
  filter: {
    search: "",
    company: "",
  },
  updateFilter: (name, value) =>
    set((state) => ({
      filter: {
        ...state.filter,
        [name]: value,
      },
    })),
}));