mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-27 08:50:56 +01:00
* feat: add actual user for trpc wss-dev-server #233 * chore: address pull request feedback * fix: deepsource issue
18 lines
471 B
TypeScript
18 lines
471 B
TypeScript
export function parseCookies(cookieString: string) {
|
|
const list: Record<string, string> = {};
|
|
const cookieHeader = cookieString;
|
|
if (!cookieHeader) return list;
|
|
|
|
cookieHeader.split(";").forEach(function (cookie) {
|
|
const items = cookie.split("=");
|
|
let name = items.shift();
|
|
name = name?.trim();
|
|
if (!name) return;
|
|
const value = items.join("=").trim();
|
|
if (!value) return;
|
|
list[name] = decodeURIComponent(value);
|
|
});
|
|
|
|
return list;
|
|
}
|