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

CPT: Expected type IvIdType, found SLUG #1040

Open
sloyer opened this issue Jul 20, 2022 · 0 comments
Open

CPT: Expected type IvIdType, found SLUG #1040

sloyer opened this issue Jul 20, 2022 · 0 comments

Comments

@sloyer
Copy link
Contributor

sloyer commented Jul 20, 2022

``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
`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant