mirror of https://github.com/abpframework/abp.git
6 changed files with 93 additions and 63 deletions
@ -1,29 +0,0 @@ |
|||
export function getCookieValueByName(name: string) { |
|||
const cookiesArray = document.cookie.split(';'); |
|||
|
|||
for (let i = 0; i < cookiesArray.length; i++) { |
|||
let cookie = cookiesArray[i].trim(); |
|||
|
|||
if (cookie.startsWith(name + '=')) { |
|||
return cookie.substring(name.length + 1); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
export function deleteAllCookies() { |
|||
var cookies = document.cookie.split("; "); |
|||
for (var c = 0; c < cookies.length; c++) { |
|||
var d = window.location.hostname.split("."); |
|||
while (d.length > 0) { |
|||
var cookieBase = encodeURIComponent(cookies[c].split(";")[0].split("=")[0]) + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=' + d.join('.') + ' ;path='; |
|||
var p = location.pathname.split('/'); |
|||
document.cookie = cookieBase + '/'; |
|||
while (p.length > 0) { |
|||
document.cookie = cookieBase + p.join('/'); |
|||
p.pop(); |
|||
}; |
|||
d.shift(); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue