Why does this.XXX have to wait to get the minor problems encountered in vue that this.XXX can't get directly?

Why does this.XXX have to wait a while to get the minor problems encountered in vue that this.XXX can"t get directly?

I am now calling two interfaces, such as An and B.
I can only call Interface B after An ends. (because API A returns data, I need to use it to get Interface B)

my code is like this

                        let promise = new Promise(function(resolve, reject) {
            //Access Token
                          axios.get("api/token?grant_type=client_credential&appid=appid&secret=secret")
                                        .then(function(response) {
                                            _this.access_token=response.data.access_token;
                                            console.log(_this.access_token);
                                        })
                                        .catch(function(error) {
                                            // error
                                            console.log(error);
                                        });
                            resolve();
                        });
                    promise.then(function() {
                      //jsapi_ticket
                      console.log(_this.access_token);
                       axios.get("api/ticket/getticket?access_token="+_this.access_token+"&type=jsapi")
                                        .then(function(response) {
                                            //    success
                                            console.log(response);
                                        })
                                        .catch(function(error) {
                                            // error
                                            console.log(error);
                                        });

                    });
                    
After the

An interface is completed, the resolve B interface is thrown for access, but my _ this.access_token is not worth it. I have to add an one-time timer to it to delay it. Why?

clipboard.png

clipboard.png


clipboard.png

Mar.11,2021

pass it down via resolve (response.data.access_token)


Hello, try axios.get (). Then (function (response) {
resolve (); / this call
} in the function requesting completion)


new promise is changed to arrow function. Every minute


there is a problem with the execution position of resolve (). If there is no response, the request is directly written by resolve () to the successful state and, resolve () is written in the judgment that the response is true.

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