Skip to content

Commit c2e3f66

Browse files
committed
refactor(client): use more specific default options initialization
1 parent 37cd256 commit c2e3f66

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

apps/meteor/client/lib/absoluteUrl.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,9 @@ export function absoluteUrl(path?: string, options?: AbsoluteUrlOptions): string
4646

4747
absoluteUrl.defaultOptions = {
4848
rootUrl: baseURI,
49+
secure: window.isSecureContext,
4950
} as AbsoluteUrlOptions;
5051

51-
const { defaultOptions } = absoluteUrl;
52-
const location = typeof window === 'object' && window.location;
53-
if (typeof __meteor_runtime_config__ === 'object' && __meteor_runtime_config__.ROOT_URL) {
54-
defaultOptions.rootUrl = __meteor_runtime_config__.ROOT_URL;
55-
} else if (location && location.protocol && location.host) {
56-
defaultOptions.rootUrl = `${location.protocol}//${location.host}`;
57-
}
58-
if (location && location.protocol === 'https:') {
59-
defaultOptions.secure = true;
60-
}
61-
6252
export function _relativeToSiteRootUrl(link: string): string {
6353
if (typeof __meteor_runtime_config__ === 'object' && link.slice(0, 1) === '/') {
6454
link = (__meteor_runtime_config__.ROOT_URL_PATH_PREFIX || '') + link;

0 commit comments

Comments
 (0)