Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

130
Visualizações
How to send the all the values till the last value in a while loop

In this, it send the last value from the query until its false, I want it to send all the previous value and the current value together, send all the values upto the hasNextPage is false

while(hasNextPage == true){
      myproducts = await axios({
        url: `https://${req.session.shop}/admin/api/2022-01/graphql.json`,
        method: 'post',
        headers: {
          "X-Shopify-Access-Token": req.session.token,
        },
        data: {
            query: `
            query($numProducts: Int!, $cursor: String)  {
              products(first: $numProducts, after: $cursor) {
                edges {
                  cursor
                  node {
                    id
                    title
                    
                  }
                }
                pageInfo {
                  hasNextPage
                  
                }
              }
            }
            `,
            variables: {
              numProducts: 2,
              cursor: productCursor
            }
        },
        

    }); 
    productCursor = myproducts.data.data.products.edges[myproducts.data.data.products.edges.length - 1].cursor;
    hasNextPage = myproducts.data.data.products.pageInfo.hasNextPage;
    }



    res.send(myproducts.data);
about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda