forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction_mutation.ts
More file actions
43 lines (40 loc) · 835 Bytes
/
action_mutation.ts
File metadata and controls
43 lines (40 loc) · 835 Bytes
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
export const js = [
{
fileName: 'app/mutations.js',
code: `
export const setLoading = state =>
state.isLoading = true
export const setInputValue = (state, value) =>
state.inputValue = value
`,
},
{
fileName: 'app/actions.js',
code: `
export const doThis = action =>
action()
.mutation(mutations.setLoading)
.mutation(mutations.setInputValue)
`,
},
]
export const ts = [
{
fileName: 'app/mutations.ts',
code: `
export const setLoading: Mutation = state =>
state.isLoading = true
export const setInputValue: Mutation<string> = (state, value) =>
state.inputValue = value
`,
},
{
fileName: 'app/actions.ts',
code: `
export const doThis: Action<string> = action =>
action()
.mutation(mutations.setLoading)
.mutation(mutations.setInputValue)
`,
},
]