diff --git a/change/@acedatacloud-nexior-8355f8c9-f9da-4367-9fc6-3a2d03d672ba.json b/change/@acedatacloud-nexior-8355f8c9-f9da-4367-9fc6-3a2d03d672ba.json new file mode 100644 index 00000000..df87d801 --- /dev/null +++ b/change/@acedatacloud-nexior-8355f8c9-f9da-4367-9fc6-3a2d03d672ba.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix for domain parsing", + "packageName": "@acedatacloud/nexior", + "email": "office@acedata.cloud", + "dependentChangeType": "patch" +} diff --git a/src/utils/initializer.ts b/src/utils/initializer.ts index 7069930a..a0ae0dd6 100644 --- a/src/utils/initializer.ts +++ b/src/utils/initializer.ts @@ -7,19 +7,22 @@ import { IToken } from '@/models'; import psl from 'psl'; export const getDomain = (host: string = window.location.hostname) => { - if (host === 'localhost') { - return host; - } const parsed = psl.parse(host); if (parsed.error) { return host; } + if (!parsed.listed) { + return host; + } if (parsed.domain === host) { return host; } return '.' + parsed.domain; }; +// @ts-ignore +window.getDomain = getDomain; + export const initializeCookies = async () => { // parse the query string and set to cookies const query = new URLSearchParams(window.location.search);