设置了与http://www.google.com/上的跨站点资源关联的cookie,但未设置“ SameSite”属性。

时间:2020-03-06 16:56:09

标签: api cookies get request fetch

我读到我需要将SameSite属性添加到cookie,但我不确定如何实现它。下面是我当前的代码:

function getAllUsers(){

 return fetch("http://localhost:3000/users")
   .then((resp) => resp.json())

   .then(function(users) {
     users.forEach(function(user) {
       postContainer.innerHTML += renderSingleProfile(user);
     }); 
     return users ;
    });
}

function renderSingleProfile(user){
  return `
    <div id ="profile-card">
    <h2>User: ${user.name}</h2>
    <img id="profile-image" src= "http://localhost:3000${user.prof_photo}"/>
    <p>Age: ${user.age}</p>
    <p>Location: ${user.location}</p>
    <p>Job: ${user.job}</p>
    <p> Species: ${user.species}</p>
    <button class="like-btn" data-id="${user.id}">Like <3 </button> 

    <input type="text" name="comments" value="" class="input-comment">
    <button class="submit-btn" data-id="${user.id}>Submit Comment </button>
    </div> `
}

0 个答案:

没有答案