Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

131
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda