Skip to content

Commit

Permalink
fix(unlock-js): handling the case where no config option is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
julien51 committed Jan 23, 2025
1 parent 5a29245 commit 43e3505
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/unlock-js/src/subgraph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@ export class SubgraphService {
graphqlClientOptions?: RequestConfig

constructor(
subgraphServiceParams: SubgraphServiceParams | NetworkConfigs | string
subgraphServiceParams:
| SubgraphServiceParams
| NetworkConfigs
| string
| undefined
) {
if (typeof subgraphServiceParams == 'string') {
if (!subgraphServiceParams) {
this.networks = networkConfigs
this.graphqlClientOptions = {}
} else if (typeof subgraphServiceParams == 'string') {
// If the first parameter is a string, we assume it's the endpoint URL
this.endpointUrl = subgraphServiceParams
this.networks = networkConfigs
Expand Down

0 comments on commit 43e3505

Please sign in to comment.