Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit fe709be

Browse files
committed
Use apollo with auth for previews
1 parent 822c7e3 commit fe709be

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

api/wordpress/_global/getPostTypeById.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import queryPostById from '../posts/queryPostById'
2-
import {initializeWpApollo} from '../connector'
2+
import {initializeWpApollo, createWpApolloClient} from '../connector'
33
import queryPageById from '../pages/queryPageById'
44
import {isHierarchicalPostType} from './postTypes'
55
import formatBlockData from '@/functions/formatBlockData'
@@ -50,7 +50,9 @@ export default async function getPostTypeById(
5050
const query = postTypeQuery?.[postType] ?? null
5151

5252
// Get/create Apollo instance.
53-
const apolloClient = initializeWpApollo()
53+
const apolloClient = preview
54+
? createWpApolloClient(true)
55+
: initializeWpApollo()
5456

5557
// Set up return object.
5658
const response = {

0 commit comments

Comments
 (0)