In Vue, according to the returned information of axios, it is sometimes necessary to re-request what has just been sent, how to implement it

When using axios to send a request in

vue, it is sometimes necessary to resend the request according to the returned information. Is there any way to achieve this? please give me some advice. Xiaobai sometimes doesn"t quite understand. Please speak to me. You"d better give me some pseudo code. Thank you

.
Jun.22,2022

this kind of requirement scenario is still common in tables (such as status refresh). The common practice is to use a timer to send the request, and then choose whether to destroy the timer according to the return


you can encapsulate this axios request as a function, and if the returned message requires a resend request, then call this function recursively
like this

function request() {
    axios.get(xxx)
    .then(res => {
        // 
        if (res.status) {
            request()
        }
    })
}

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