-
Notifications
You must be signed in to change notification settings - Fork 0
/
contentful.js
52 lines (46 loc) · 1.51 KB
/
contentful.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
const client = require('contentful').createClient({
space: process.env.NEXT_PUBLIC_CONTENTFUL_SPACE_ID,
accessToken: process.env.NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN
})
export async function fetchPostContent() {
const entries = await client.getEntries({
content_type: 'post',
})
if (entries.items) return entries.items
console.log(`Error getting Entries for ${contentType.name}.`)
}
export async function fetchHomeContent() {
const entries = await client.getEntries({
content_type: 'home',
})
if (entries.items) return entries.items
console.log(`Error getting Entries for ${contentType.name}.`)
}
export async function fetchMenuContent() {
const entries = await client.getEntries({
content_type: 'menu',
})
if (entries.items) return entries.items
console.log(`Error getting Entries for ${contentType.name}.`)
}
export async function fetchWorkContent() {
const entries = await client.getEntries({
content_type: 'work',
})
if (entries.items) return entries.items
console.log(`Error getting Entries for ${contentType.name}.`)
}
export async function fetchProjectsContent() {
const entries = await client.getEntries({
content_type: 'projects',
})
if (entries.items) return entries.items
console.log(`Error getting Entries for ${contentType.name}.`)
}
export async function fetchAboutContent() {
const entries = await client.getEntries({
content_type: 'about',
})
if (entries.items) return entries.items
console.log(`Error getting Entries for ${contentType.name}.`)
}