Skip to content

Commit c075060

Browse files
updating to include an alternate url when api.url.com does not exist (#225)
1 parent 8faa066 commit c075060

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/api-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class APIClient {
169169
targetUrl = new URL(url, vars.apiUrl)
170170
}
171171

172-
const isHerokuApi = ALLOWED_HEROKU_DOMAINS.some(domain => targetUrl.hostname.endsWith(`.${domain}`))
172+
const isHerokuApi = ALLOWED_HEROKU_DOMAINS.some(domain => targetUrl.hostname.endsWith(`.${domain}`) || targetUrl.hostname === domain)
173173
const isLocalhost = LOCALHOST_DOMAINS.includes(targetUrl.hostname as (typeof LOCALHOST_DOMAINS)[number])
174174

175175
if (isHerokuApi || isLocalhost) {

src/vars.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class Vars {
7777
// Remove protocol if present
7878
const cleanHost = host.replace(/^https?:\/\//, '')
7979

80-
return ALLOWED_HEROKU_DOMAINS.some(domain => cleanHost.endsWith(`.${domain}`)) || LOCALHOST_DOMAINS.some(domain => cleanHost.includes(domain))
80+
return ALLOWED_HEROKU_DOMAINS.some(domain => cleanHost.endsWith(`.${domain}`) || cleanHost === domain) || LOCALHOST_DOMAINS.some(domain => cleanHost.includes(domain))
8181
}
8282
}
8383

0 commit comments

Comments
 (0)