forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomposing.ts
More file actions
45 lines (39 loc) · 954 Bytes
/
composing.ts
File metadata and controls
45 lines (39 loc) · 954 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
44
45
export default (ts) =>
ts
? [
{
fileName: 'app/actions.ts',
code: `
import { Action } from 'overmind'
import * as operations from './operations'
export const loadApplication: Action = action =>
action
export const getValidToken: Action = action =>
action
export const initializeApp: Action = action =>
action
.when(operations.hasValidToken, {
true: loadApplication,
false: action => getValidToken(action).compose(loadApplication)
})
`,
},
]
: [
{
fileName: 'app/actions.js',
code: `
import * as operations from './operations'
export const loadApplication = action =>
action
export const getValidToken = action =>
action
export const initializeApp = action =>
action
.when(operations.hasValidToken, {
true: loadApplication,
false: action => getValidToken(action).compose(loadApplication)
})
`,
},
]