Post Request return login.html when try to reterive translation from graphql

Post Request return login.html when try to reterive translation from graphql

qasim-yousaf
Visitor
1 0 0

Hi flocks, I try to fetch the product details in another locale, so I trying to hit a post request using apollo client & useLazyQuery 

 

export const GET_TRANSLATION = gql`
  {
    translatableResource(resourceId: "gid://shopify/Product/7277266895030") {
      resourceId
      translatableContent {
        key
        value
      }
      translations(locale: "ar") {
        key
        value
      }
    }
  }
`
 const [
    getTranslation,
    { data: dataGetTranslation, loading: loading, error: error },
  ] = useLazyQuery(GET_TRANSLATION, {
    fetchPolicy: 'network-only',
    variables: {
      'X-Shopify-Storefront-Access-Token': 'My-TOken',
      'Content-Type': 'application/graphql',
      Accept: 'application/json',
      'Cache-Control': 'no-cache',
  
    },
    onCompleted: res => {
      console.log('Translation Response ===========', JSON.stringify(res))
    },
    onError: err => {
      console.log('------------ My Error ------------', JSON.stringify(err))
    },
  })

 

 but it returns a login.html page in response when I try to run this same thing on postmen it works, as I have to clear the cookie first in postmen. Note the above error is come in react native side. kindly guide me on how I can get the correct response on react native side 
my store URL is 

 

https://apiKey:password@hostname.myshopify.com/admin/api/unstable/graphql.json

 

 

Replies 0 (0)