@vaadin/hilla-frontend
Version:
Hilla core frontend utils
10 lines • 492 B
JavaScript
import Cookies from "js-cookie";
export function calculatePath({ pathname }) {
return pathname.length > 1 && pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
}
const CookieManager = Cookies.withAttributes({ path: calculatePath(
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
globalThis.document ? new URL(globalThis.document.baseURI) : new URL(".", globalThis.location.href)
) });
export default CookieManager;
//# sourceMappingURL=./CookieManager.js.map