Request header when submitting axios to submit data

I reported a 419 error when using axios.post.
there is an API at the backend to get the CSRF token (X-CSRF-TOKEN)
you can only submit data if you add this to the request header.
however, I checked the axios and Baidu, and customized the configuration

.

const apiData = axios.create ({
baseURI: "address",
headers: {""} / / am I going to add headers: {"Xmuri CSRF token: get the data returned by the above csrf}) is this the request header?

})

clipboard.pnggetheaders

// apiData apiData.post("")

clipboard.png

clipboard.png

clipboard.png

Mar.05,2021

document

  1. set header, in the way you create the instance first

    const apiData = axios.create({
      baseURL: 'https://some-domain.com/api/',
      headers: {'X-CSRF-TOKEN':csrf}
    });
  2. The
  3. call is still normal. Post () write what you want to write. You can just create an instance as if you set the default parameters at once.
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-1b3869a-2c127.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-1b3869a-2c127.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?