Promise async problem

axios global request interceptor needs to request a method to get the return value in return config
because the method is requested asynchronously, so use Promise

axios.interceptors.request.use(config => {
    return new Promise(resolve => {
        window.__nativeFn("js_getAllDeviceInfo", {
            // ios
            response: r => {
                config.data = Object.assign(config.data, r.data)
                // window.vue.$Tips.info(r.data, 2000)
                resolve(config)
            }
        })
    })

}, error => {
    return Promise.reject(error)
});

when a page has only one request, this is ok. When a page has more than one request, the config of the last request will overwrite the config of all previous requests and only send one request. I don"t know why. What should we do if we solve the problem? Or in what way I can achieve the desired results and wait for the ios response in return config


does every request go to get device information? Why not cache it?


Don't send the definition code of promise, but also send how you call it.


Thank you for answering because of the question encapsulated by my _ _ nativeFn method because the ios method js_getAllDeviceInfo needs to be called before each interface request. The anonymous function I response automatically generates and mounts on window, so the second, third, and so on api request has been rewriting this method

.
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-1bdd7ce-3136a.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-1bdd7ce-3136a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?