fetch函数请求数据时带上cookie

fetch函数中带上 credentials: ‘include’

fetch("url", { method: 'POST(GET)',credentials: "include" }).then(
      function (res) {
        console.log(res)
        res.json().then(function (item) {
        	this.setState({
          })
        }
        )
      });

你可能感兴趣的:(fetch函数请求数据时带上cookie)