Skip to content

Commit

Permalink
feat: allow to pass options for latest apollo/rest-datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
jmvtrinidad committed Nov 6, 2024
1 parent 9c1a7fe commit 09aa2f0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/typescript-fetch/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ export class Controllers {
{{classname}}: {{classname}}Api
{{/operations}}{{/apis}}{{/apiInfo}}

constructor(...args) {
constructor(options) {
{{#apiInfo}}{{#apis}}{{#operations}}
this.{{classname}} = new {{classname}}Api(...args)
this.{{classname}} = new {{classname}}Api(typeof options === 'string' ? { baseUrl: options }: options)
{{/operations}}{{/apis}}{{/apiInfo}}
}
initialize(config) {
Expand All @@ -124,9 +124,9 @@ export class Controllers {
{{#apiInfo}}{{#apis}}{{#operations}}

export class {{classname}}Api extends {{dataSourceName}} {
constructor(baseUrl?: string) {
super();
this.baseURL = baseUrl;
constructor(options?: any) {
super(options.context ? options : undefined);
this.baseURL = options?.baseUrl;
}
paramCreator = {{classname}}FetchParamCreator()
{{#operation}}
Expand Down

0 comments on commit 09aa2f0

Please sign in to comment.