How does the axios request data differ in the following ways, and how do you pass the same parameters as in the first case in the encapsulated axios method?

the company is now carrying out the front-end separation project. I use the axios method to ask for data at the front end. There are only the first and third data methods that can be used to request the API. But obviously, the data transmitted by the two methods are different. Because I do not quite understand the principle, I would like to ask a question here. I hope you can give us some advice.

the data that can be successfully requested by the login API is as follows:
request method:

clipboard.png

:

clipboard.png

:

clipboard.png

axios:
:
:

clipboard.png

:

clipboard.png

clipboard.png

::

clipboard.png

clipboard.png

:

clipboard.png

clipboard.png

Mar.21,2021

success here depends only on the Content-Type that the back end can handle. It may not be possible to change the back end which is right and which is wrong.


modify the first encapsulated method:

export function login(username, password) {
  return request({
       url: '...',
       method: '...',
       // 
       // axios post Content-type  x-www-form-urlencoded, data 
       //  get  params 
       data: {
           username,
           password
       } 
   })  
}
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-1c02421-325ce.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-1c02421-325ce.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?