Skip to content

Commit

Permalink
feat: add constants for regions
Browse files Browse the repository at this point in the history
  • Loading branch information
christyjacob4 committed Nov 12, 2024
1 parent 4159544 commit 2f744a8
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/lib/stores/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@ export function getApiEndpoint(region?: string): string {
return `${protocol}://${subdomain}${hostname}/v1`;
}

const REGION_FRA = 'fra';
const REGION_SYD = 'syd';
const REGION_NYC = 'nyc';

const SUBDOMAIN_FRA = 'fra.';
const SUBDOMAIN_SYD = 'syd.';
const SUBDOMAIN_NYC = 'nyc.';

const getSubdomain = (region?: string) => {
switch (region) {
case 'fra':
return 'fra.';
case 'syd':
return 'syd.';
case 'nyc':
return 'nyc.';
case REGION_FRA:
return SUBDOMAIN_FRA;
case REGION_SYD:
return SUBDOMAIN_SYD;
case REGION_NYC:
return SUBDOMAIN_NYC;
default:
return '';
}
Expand Down

0 comments on commit 2f744a8

Please sign in to comment.