mirror of
https://github.com/LaconicNetwork/laconic.com.git
synced 2026-03-09 17:34:07 +00:00
19 lines
452 B
TypeScript
19 lines
452 B
TypeScript
import { GraphQLClient } from 'graphql-request'
|
|
|
|
import { getSdk } from './generated'
|
|
|
|
const cms = (preview?: boolean) => {
|
|
const endpoint = 'https://graphql.datocms.com/'
|
|
const previewEndpoint = 'https://graphql.datocms.com/preview'
|
|
|
|
return getSdk(
|
|
new GraphQLClient(preview ? previewEndpoint : endpoint, {
|
|
headers: {
|
|
Authorization: `Bearer ${process.env.NEXT_PUBLIC_CMS_ACCESS_TOKEN}`
|
|
}
|
|
})
|
|
)
|
|
}
|
|
|
|
export default cms
|