Can Mini Program interceptor intercept on the request interface?

app.globalData.Authorization is the global variable that saves token

http({ url, data, method }) {
    return new Promise((resolve, reject) => {
      const app = getApp();
      wx.request({
        url: url,
        data: data,
        method,
        header: {"token": app.globalData.Authorization },
        success(res) {
          res.statusCode === 200 ? resolve(res.data) : reject(res.data);
          // 
        },
        fail(res) {
          reject(res)
        }
      })
    })
  }
}

API success is 200. you must skip to the success method, and if you fail, jump to the fail method. Of course, you can choose to judge again

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