Skip to content

Commit b27fcc7

Browse files
committed
Handle staging subdomain
1 parent 200ae2c commit b27fcc7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/app/models/adoption-info.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ export type AdoptionData = {
88
}[];
99
};
1010

11-
const url = 'https://salesforce.openstax.org/api/v1/adoptions';
11+
type WindowWithSettings = typeof window & {
12+
SETTINGS: {
13+
accountHref: string;
14+
};
15+
}
16+
const w = window as WindowWithSettings;
17+
const subdomains = ['staging.'];
18+
const subdomain = subdomains.find((sd) => w.SETTINGS.accountHref?.includes(sd)) || '';
19+
const url = `https://${subdomain}salesforce.openstax.org/api/v1/adoptions`;
1220
const TESTING = process.env.JEST_WORKER_ID !== undefined;
1321
/* eslint-disable camelcase */
1422
const testData = {

0 commit comments

Comments
 (0)