Skip to content

Commit

Permalink
feat: add endpoint to config as an alias
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjoverm committed Jun 26, 2023
1 parent e7be86b commit 64d5f56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ class Storyblok {
* @param config ISbConfig interface
* @param endpoint string, optional
*/
public constructor(config: ISbConfig, endpoint?: string) {
public constructor(config: ISbConfig, pEndpoint?: string) {
let endpoint = config.endpoint || pEndpoint

if (!endpoint) {
const getRegion = new SbHelpers().getRegionURL
const protocol = config.https === false ? 'http' : 'https'
Expand Down Expand Up @@ -585,7 +587,7 @@ class Storyblok {
retries = retries ? retries + 1 : 0

if (retries < this.maxRetries) {
console.log(`Hit rate limit. Retrying in ${retries} seconds.`);
console.log(`Hit rate limit. Retrying in ${retries} seconds.`)
await this.helpers.delay(1000 * retries)
return this.cacheResponse(url, params, retries)
.then(resolve)
Expand Down
5 changes: 3 additions & 2 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export interface ISbConfig {
rateLimit?: number
componentResolver?: (component: string, data: any) => void
richTextSchema?: ISbSchema
endpoint?: string
}

export interface ISbResult {
Expand Down Expand Up @@ -265,8 +266,8 @@ export interface ISbRichtext {
}

export interface LinkCustomAttributes {
rel?: string,
title?: string,
rel?: string
title?: string
[key: string]: any
}

Expand Down

0 comments on commit 64d5f56

Please sign in to comment.