How to resolve array data after promise.all.then ()

problem description

promise.all (promises); promises is a request array that hopes to resolve the data after the request, but it is not successful.

the environmental background of the problem

there are five get requests on the home page, and the axios timeout intercept shows a div, click to reinitiate the request, but the foreground page receives the response, with only the last request, so I put the request in an array and initiate it with promise.all, but cannot resolve the data

related codes

/ / Please paste the code text below (do not replace the code with pictures)

import Axios from "axios"
import Qs from "qs"
import Vue from "vue"
Axios.defaults.timeout = 500
var configArr=[]
const request = (options) => new Promise((resolve, reject) => {
    const page404 = (config) => {
        var Arr = [config];
        if(configArr.length>0){
            if(Arr.indexOf(configArr)<0){
                configArr.push(config);
            }
        }else{
            configArr.push(config);
        }
        var configarr=[];
        for(var i=0;i<configArr.length;iPP){
            if(configarr.indexOf(configArr[i])<0){
                configarr.push(configArr[i]);
            }
        }
        document.getElementById("loadAgain").style.display="block";
        let c = Vue.extend({
        template:"<div id="loadAgain" @click="loadAgain"><div class="loadBox"><img src="static/img/woply_404@2x.png"/></div><p class="load-p">

<p class="load-p">

</div>", methods: { loadAgain() { configArr=[]; let promises=[]; let result=[]; for(let i=0;i<configarr.length;iPP){ promises.push(new Promise((resolve1, reject1) =>{ return request(configarr[i]).then((res) => { if (typeof res == "string") { res = JSON.parse(res) } result.push(res); resolve1(res); }) .catch((err) => { }) resolve1(result) })) } Promise.all(promises).then(resultArray => { console.log(result); console.log(resultArray); resolve(resultArray) }) result=[]; configarr=[] document.getElementById("loadAgain").style.display="none"; } } }) new c().$mount("-sharploadAgain"); } Axios.interceptors.response.use((response) => { //404 document.getElementById("loadAgain").style.display="none"; return response; }, (error) => { let config=error.config; if(error.code=="ECONNABORTED"&& error.message.indexOf("timeout")!=-1){ // document.getElementById("loadAgain").style.display="block"; page404(config); } if(error.message.indexOf("Network")!=-1){ // setTimeout(function(){ page404(config); },5000) } return Promise.reject(error); }); Axios.request(options) .then((res) => { if (typeof res == "string") { res = JSON.parse(res) } resolve(res) }) .catch((err) => { }) }) export default { get: (URL,options) => new Promise((resolve, reject) => { return request(Object.assign({}, options, { method: "get" ,url:URL})).then(res => {resolve(res)}) }), post: (URL,params,options) => new Promise((resolve, reject) => { return request(Object.assign({}, options, { method: "post", url:URL, headers: { "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", }, data:params, paramsSerializer: function(params) { return Qs.stringify(params, {arrayFormat: "brackets"}) }, })).then(res => {resolve(res)}) }) }

what result do you expect? What is the error message actually seen?

after resolve, the home page request can get response, but does not go there

May.31,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bede5f-31bb9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bede5f-31bb9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?