2016-12-19 42 views
1

我的cookie隨時更改,只要我嘗試註銷,首先我會在登錄成功時進行烹飪,然後嘗試註銷我的cookie更改並註銷將失敗。下面是我的代碼:地址請求cookie更改登錄和註銷使用反應

代碼登錄:

$.ajax({ 
    method: "POST", 
    url: unicornRes("login"), 
    contentType: "application/json", 
    data: JSON.stringify({ 
    userAcc: email, 
    userPwd: password 
    }) 
}).fail((err)=> { 
    console.log(err); 
    this.setState({loginInputErr: "loginFail", password: ""}); 
}).done((data) => { 
    console.log("login Mode:", data.message); 
    localStorage.setItem("unicorn", data.message); 
    $.ajaxSetup({ 
    xhrFields: { 
     withCredentials: true 
    } 
    }); 
    router.push('/'); 
}); 

代碼註銷:

3ACek0_Zp2HVUtz5itimy8eW_8hChv3jeq 
:從

3A6pkDbK4JNrkwevjH (part of cookie) 

$.ajax({ 
    method: "POST", 
    url: unicornRes("logout") 
}).fail((err)=> { 
    console.log(err); 
}).done((data) => { 
    localStorage.setItem("unicorn", data.message); 
    router.push('/login'); 
}); 

餅乾變化

它爲什麼會改變?我需要cookie註銷相同。

回答