This repository was archived by the owner on Feb 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
CPT: Expected type IvIdType, found SLUG #1040
Copy link
Copy link
Open
Description
``Hey there,
Running into an issue retrieving posts by an ID.
I can view my posts on /ivs and see all them there, but clicking into them results too "Expected type IvIdType, found SLUG"
Has anyone ran into a similar issues, this is my first time coming around to it.
queryIvById.js file
`import authorPostFields from '@/lib/wordpress/_query-partials/authorPostFields'
import defaultPageData from '@/lib/wordpress/_query-partials/defaultPageData'
import featuredImagePostFields from '@/lib/wordpress/_query-partials/featuredImagePostFields'
import globalPostFields from '@/lib/wordpress/_query-partials/globalPostFields'
import seoPostFields from '@/lib/wordpress/_query-partials/seoPostFields'
import { gql } from '@apollo/client'
// Fragment: retrieve single team member fields.
const singleIvFragment = gql`
fragment SingleIvFields on Iv {
${globalPostFields}
blocksJSON
excerpt
${seoPostFields}
${authorPostFields}
${featuredImagePostFields}
}
`
// Query: retrieve team member by specified identifier.
const queryIvById = gql`
query GET_IV_BY_ID(
$id: ID!
$idType: IvIdType = SLUG
$imageSize: MediaItemSizeEnum = LARGE
) {
${defaultPageData}
iv(id: $id, idType: $idType) {
...SingleIvFields
}
}
${singleIvFragment}
`
export default queryIvById
`
````import authorPostFields from '@/lib/wordpress/_query-partials/authorPostFields'
import defaultPageData from '@/lib/wordpress/_query-partials/defaultPageData'
import featuredImagePostFields from '@/lib/wordpress/_query-partials/featuredImagePostFields'
import globalPostFields from '@/lib/wordpress/_query-partials/globalPostFields'
import seoPostFields from '@/lib/wordpress/_query-partials/seoPostFields'
import { gql } from '@apollo/client'
// Fragment: retrieve single team member fields.
const singleIvFragment = gql`
fragment SingleIvFields on Iv {
${globalPostFields}
blocksJSON
excerpt
${seoPostFields}
${authorPostFields}
${featuredImagePostFields}
}
`
// Query: retrieve team member by specified identifier.
const queryIvById = gql`
query GET_IV_BY_ID(
$id: ID!
$idType: IvIdType = SLUG
$imageSize: MediaItemSizeEnum = LARGE
) {
${defaultPageData}
iv(id: $id, idType: $idType) {
...SingleIvFields
}
}
${singleIvFragment}
`
export default queryIvById
`
`import authorPostFields from '@/lib/wordpress/_query-partials/authorPostFields'
import defaultPageData from '@/lib/wordpress/_query-partials/defaultPageData'
import featuredImagePostFields from '@/lib/wordpress/_query-partials/featuredImagePostFields'
import globalPostFields from '@/lib/wordpress/_query-partials/globalPostFields'
import seoPostFields from '@/lib/wordpress/_query-partials/seoPostFields'
import { gql } from '@apollo/client'
// Fragment: retrieve single team member fields.
const singleIvFragment = gql`
fragment SingleIvFields on Iv {
${globalPostFields}
blocksJSON
excerpt
${seoPostFields}
${authorPostFields}
${featuredImagePostFields}
}
`
// Query: retrieve team member by specified identifier.
const queryIvById = gql`
query GET_IV_BY_ID(
$id: ID!
$idType: IvIdType = SLUG
$imageSize: MediaItemSizeEnum = LARGE
) {
${defaultPageData}
iv(id: $id, idType: $idType) {
...SingleIvFields
}
}
${singleIvFragment}
`
export default queryIvById
`
Metadata
Metadata
Assignees
Labels
No labels