Axios request get method request data hop error

problem description

when axios requests data, it directly catch the error response. Instead of reading the response, in the axios.get (). Then () method, it jumps directly to the err, in catch and prints out the error message

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

axios.get ("/ api/ac/app.json"). Then (response = > {

)
          if(response && response.status === 200) {
            console.log("******")
            if(response.data.errcode === 0){
              try{
                this.result = response.data.data;
              } catch (err) {
                throw new Error("")
              }
            }
          } else {
            this.$alert("","",{
              confirmButtonText: "",
              callback: action => {
                this.$message({
                  type: "info",
                  message: ""
                });
              }
            })
          }
        }).catch(err => {
          console.log(err)
        });

what result do you expect? What is the error message actually seen?

expect the json data returned by the response response
what you actually see is

Error: Request failed with status code 404

at createErrorResponse (utils.js?98cb:117)
at Object.settle (utils.js?98cb:97)
at handleRequest (handle_request.js?fff0:73)
at eval (index.js?3efb:18)
at new Promise (<anonymous>)
at MockAdapter.eval (index.js?3efb:17)
at dispatchRequest (dispatchRequest.js?5c70:52)
May.22,2021

Interface 404.First of all, confirm whether there is a problem with your interface


.

Menu