fix: improve unified settings (#3160)

This commit is contained in:
David Nguyen
2026-08-10 14:57:19 +10:00
committed by GitHub
parent fc95ee9ead
commit 797f5c0e79
24 changed files with 129 additions and 114 deletions
+17
View File
@@ -0,0 +1,17 @@
/**
* Read a cookie value from `document.cookie`.
*
* Client-side counterpart of `extractCookieFromHeaders`. Only works for cookies that
* are not `HttpOnly`, such as the preferred team URL cookie.
*/
export const extractCookieFromDocument = (cookieName: string): string | null => {
const cookiePairs = document.cookie.split(';');
const cookie = cookiePairs.find((pair) => pair.trim().startsWith(`${cookieName}=`));
if (!cookie) {
return null;
}
return cookie.split('=')[1].trim();
};