mirror of
https://github.com/wukko/cobalt.git
synced 2025-01-12 20:25:06 +01:00
cookie: allow updating cookie values directly
This commit is contained in:
parent
f1152f4862
commit
035f5a7839
1 changed files with 3 additions and 0 deletions
|
@ -56,7 +56,10 @@ export function updateCookie(cookie, headers) {
|
||||||
|
|
||||||
cookie.unset(parsed.filter(c => c.expires < new Date()).map(c => c.name));
|
cookie.unset(parsed.filter(c => c.expires < new Date()).map(c => c.name));
|
||||||
parsed.filter(c => !c.expires || c.expires > new Date()).forEach(c => values[c.name] = c.value);
|
parsed.filter(c => !c.expires || c.expires > new Date()).forEach(c => values[c.name] = c.value);
|
||||||
|
updateCookieValues(cookie, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateCookieValues(cookie, values) {
|
||||||
cookie.set(values);
|
cookie.set(values);
|
||||||
if (Object.keys(values).length) dirty = true
|
if (Object.keys(values).length) dirty = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue