forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheffects.ts
More file actions
37 lines (35 loc) · 733 Bytes
/
effects.ts
File metadata and controls
37 lines (35 loc) · 733 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
export default (ts) =>
ts
? [
{
fileName: 'app/effects.ts',
code: `
import axios from 'axios'
import { User, Item } from './state'
export const api = {
getUser(): Promise<User> {
return fetch('/user').then(response => response.json())
},
getItem(id: number): Promise<Item> {
return fetch(\`/items/\${id}\`).then(response => response.json())
}
}
`,
},
]
: [
{
fileName: 'effects.js',
code: `
import axios from 'axios'
export const api = {
getUser() {
return fetch('/user').then(response => response.json())
},
getItem(id) {
return fetch(\`/items/\${id}\`).then(response => response.json())
}
}
`,
},
]