Request interceptor and response interceptor:

  1. As for interception, here is just the principle. The front-end request is ultimately dependent on Ajax. Vue’s VUe-Resource and Axios are all just unified encapsulation of Ajax. When executing this method, the request header is added to the token, password, etc. Depending on the actual situation) to perform again, are assigned to a variable, and then unified to ajax, the next is to perform ajax, this is the request to intercept, is actually perform to add data first, and then execute ajax, if pulled out the process of adding data, is the so-called request interceptor;
  2. Response interceptor: The response interceptor is the same, that is, after the result of the request is returned, it is not directly exported, but the response code is first processed, and then exported to the page. If the processing process of the response code is extracted, it becomes the so-called response interceptor;