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

CPT: Expected type IvIdType, found SLUG #1040

Description

@sloyer

``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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions