-
Notifications
You must be signed in to change notification settings - Fork 0
/
themeStore.ts
80 lines (79 loc) · 1.74 KB
/
themeStore.ts
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import create from "zustand";
import produce from "immer";
import { deepSet, deepGet } from "helpers/P7StateForm";
export const useThemeStore = create((set) => ({
theme: {
refreshAppState:0,
colorMode: "light",
globalMessage: {
text: "",
status: "success",
},
formMessage: {
text: "",
status: "success",
},
modal: {
bodyTarget: "",
},
toaster: {
message: "",
type:"success"
},
right: {
bodyTarget: "",
},
currentUser: {
id: null,
username: null,
},
dropdown: false,
customData: {
selectedCompany: null,
companies: [
{
name: "Kruger und sohns",
tin: "DE5423210047",
mainscoring: {
first: 50,
second: 20,
third: 34,
fourth: 24,
},
onBlacklist: false,
verificationstatus: 0,
merchantlimit: 300,
sugestlimit: 30000,
vatstatus: true,
marketactivity: false,
address: {
street: "UL. JANA HENRYKA KOBROWSKIEGO 28",
postal: "45-872",
city: "BIAŁYSTOK",
country: "DE",
},
},
],
verifiedCompaniesIndex: [],
blacklistedCompaniesIndex: [],
},
},
setAttr: (_in: { path: string; value: any }) =>
set(
produce((_) => {
deepSet(_, _in.path, _in.value);
})
),
pushElement: (_in: { path: string; element: any }) =>
set(
produce((_) => {
deepGet(_, _in.path).push(_in.element);
})
),
removeElement: (_in: { path: string; index: string }) =>
set(
produce((_) => {
deepGet(_, _in.path).splice(_in.index, 1);
})
),
}));