-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetchData.js
executable file
·61 lines (57 loc) · 1.4 KB
/
fetchData.js
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
import fetcher from '@wearelucid/api-fetcher'
import config from './config'
// prettier-ignore
import {
flattenACF,
removeFieldsFromPost,
decodeTitle,
reduceBundle
} from '@wearelucid/vuecid-helpers'
// TODO: setup your fetcher settings (posts, pages, options, menus, paginated posts ect.)
fetcher.log.printText('HeadlessWP')
fetcher.log.printConfig(config.fetcherConfig)
// comment if you don't want paginated posts
fetcher.paginate(
'posts',
{
posts: {
method: fetcher.getWPPostType,
postType: 'posts',
transforms: [removeFieldsFromPost, decodeTitle]
}
},
config.fetcherConfigPosts
)
fetcher.bundle(
'basic',
{
// Reduced bundle for all pages
pages: {
method: fetcher.getWPPostType,
postType: 'pages',
transforms: [flattenACF, removeFieldsFromPost, decodeTitle]
},
// Reduced bundle for all posts
posts: {
method: fetcher.getWPPostType,
postType: 'posts',
transforms: [flattenACF, removeFieldsFromPost, decodeTitle, reduceBundle]
},
menus: {
method: fetcher.getWPMenus
},
'options-global': {
method: fetcher.getWPOptionsPage,
slug: 'global-site-settings'
},
'options-en': {
method: fetcher.getWPOptionsPage,
slug: 'en-site-settings'
},
'options-ar': {
method: fetcher.getWPOptionsPage,
slug: 'ar-site-settings'
}
},
config.fetcherConfig
)