How does JS solve the asynchronous problem?

in the if else statement, I have asynchronous requests. I set the interceptor after getting the data of the asynchronous request. My idea is that there is no way to set the interceptor after the if else is finished. My current idea is to use ES7 async await, but Mini Program does not support it at present. Another way is to add then, in the if else, but you have to write the interceptor twice. Do you have a better solution?
Mar.16,2021

encapsulate the above two asynchronous requests with a promise , and then set the interceptor in the then of this promise :

new Promise((resolve, reject) => {
  if (!res.authSetting...) {
    fly.get('/init.ujson').then(res => {
      ...
    }).then(resolve)
  } else {
    wx.getUserInfo({
      ...
    }).then(resolve)
  }
}).then(res => {
  fly.interceptors...
})
Menu