This repository was archived by the owner on Feb 27, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -19,14 +19,14 @@ import getMenus from '../menus/getMenus'
19
19
* @param {string } postType WP post type.
20
20
* @param {number | string } id Post identifier.
21
21
* @param {string } idType Type of ID.
22
- * @param {boolean } preview Whether checking if post preview exists .
22
+ * @param {string } preview Whether query is for a regular post view (null), a preview check (basic), or full post preview (full) .
23
23
* @return {object } Object containing Apollo client instance and post data or error object.
24
24
*/
25
25
export default async function getPostTypeById (
26
26
postType ,
27
27
id ,
28
28
idType = 'SLUG' ,
29
- preview = false
29
+ preview = null
30
30
) {
31
31
// Define single post query based on post type.
32
32
const postTypeQuery = {
@@ -99,7 +99,7 @@ export default async function getPostTypeById(
99
99
slug : id
100
100
}
101
101
102
- if ( preview || ! post || ! post ?. blocksJSON ) {
102
+ if ( 'basic' === preview || ! post || ! post ?. blocksJSON ) {
103
103
return post
104
104
}
105
105
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ export default async function preview(req, res) {
27
27
post_type ,
28
28
id ,
29
29
'DATABASE_ID' ,
30
- true
30
+ 'basic'
31
31
)
32
32
33
33
// Handle response errors.
You can’t perform that action at this time.
0 commit comments