📜  axios 如何在发布后设置标题 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:49.378000             🧑  作者: Mango

代码示例5
axios returns data in the data object, go with:
const loginHandler = (e) => {
    e.preventDefault();
    try {
      axios.post('http://localhost:5000/api/auth/login',
        {
        email,
        password
      }
      ).then(res => localStorage.setItem("refreshToken", res.data.refreshToken))
    } catch (err) {
      console.log(err)
    }
  }