我创建了一个名为' stateCookie'当我开始我的应用程序。当我改变状态时,我将变量添加到该cookie中。当我退出时,我希望这个cookie被彻底销毁或空。
On their docs it's just remove()我已经完成了,但Cookie仍然存在。即:>>> refreshCookie {"ticker":"SPY","term_id_1":5112166,"term_id_2":30111615,"term_id_3":13064871}
退出并登录后:
this.logout = () => AuthFactory.webservice_logout().then((res) => {
// $cookies.remove('stateCookie');
angular.forEach($cookies, function(value, key) {
$cookies.remove(key);
});
// console.log('$cookies', $cookies);
// $cookies.map((value, key) => {
// $cookies.remove(key);
// });
const refreshCookie = $cookies.get('stateCookie');
console.log('!!!refreshCookie', refreshCookie);
$state.go('login', {}).then(() => {
$state.reload();
});
});
login
我可以在返回$state.go('login', {}).then(() => window.location.reload(true));
状态后通过调用window.reload来清除cookie。
import json
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
url = "https://maps.googleapis.com/maps/api/geocode/json?address=1+acmh pennsylvania+1&key = <YOUR KEY HERE>"
content = urlopen(url).read().decode('utf-8')
info = json.loads(content)
答案 0 :(得分:0)
试试这个:
this.logout = () => AuthFactory.webservice_logout().then((res) => {
// $cookies.remove('stateCookie');
var cookies = $cookies.getAll();
console.log(cookies);
angular.forEach(cookies, function(value, key) {
$cookies.remove(key);
});
// console.log('$cookies', $cookies);
// $cookies.map((value, key) => {
// $cookies.remove(key);
// });
const refreshCookie = $cookies.get('stateCookie');
console.log('!!!refreshCookie', refreshCookie);
$state.go('login', {}).then(() => {
$state.reload();
});
});