blob: 09e8146c2dadd8691b81ea7b3bd34d95f53c20f1 (
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
27
28
29
30
31
32
33
34
35
36
|
import { create } from "zustand";
import { SelectOption } from "../types/select";
type State = {
filter: {
search: string;
company: string;
show: string;
};
companies: SelectOption[];
};
type Action = {
updateFilter: (name: string, value: string) => void;
setCompanies: (data: SelectOption[]) => void;
};
export const useResultStore = create<State & Action>((set) => ({
filter: {
search: "",
company: "",
show: "1",
},
updateFilter: (name, value) =>
set((state) => ({
filter: {
...state.filter,
[name]: value,
},
})),
companies: [],
setCompanies: (data) =>
set(() => ({
companies: data,
})),
}));
|