Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
704 B
1
Indexable
Never
async function main(){
var orders = []
var page = 1
var subscriptionsIds = []    

return leer(page,orders)

}



async function leer(page, orders){
  
  		return new Promise((resolve, reject) => {
      Ventas.trigger({
      additionalScope: 
      {
        page: page
      },
      onSuccess: async (data) => {

				orders = [...orders,...data]
        
        for (var i = 0; i < data.length; i++) {

          
        }
        console.log(orders)
        if(data.length > 0){
               leer(page+1, orders).then((da)=>{
                  resolve(da)
                })
        }else{
          resolve(orders)
        }
        
        }
      })
        
      });
  		
}

return main();