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
45 lines (39 loc) · 796 Bytes
/
effects.ts
File metadata and controls
45 lines (39 loc) · 796 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: 'overmind/effects.ts',
code: `
import axios from 'axios'
import { User, Item } from './state'
export const api = {
async getUser(): Promise<User> {
const response = await fetch('/user')
return response.json()
},
async getItem(id: number): Promise<Item> {
const response = await fetch(\`/items/\${id}\`)
return response.json()
}
}
`,
},
]
: [
{
fileName: 'effects.js',
code: `
import axios from 'axios'
export const api = {
async getUser() {
const response = await fetch('/user')
return response.json()
},
async getItem(id) {
const response = fetch(\`/items/\${id}\`)
return response.json()
}
}
`,
},
]