You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using the fetch template with the typescript generator. When we generate clients, we have to always supply a rootUrl and http argument. Our http parameter does some extra checks, and assigns credentials. It would be nice to have this generated.
For the rootUrl, the generator generates this: this.baseUrl = this.getBaseUrl("", baseUrl);
So it seems that the solution is to a base class which supplies the getBaseUrl function. This is fine with us, as we need a base class to supply the date reviver anyway.
However, there doesn't seem to be a way to have a default argument for the http parameter, it is always generated as: this.http = http ? http : window as any; I really don't want to assign something to window.fetch, in case it breaks a 3rd party. It would be nice if that argument worked like it does for the baseUrl.
I suppose I could override the Fetch template.... What have others does in this scenario?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We are using the fetch template with the typescript generator. When we generate clients, we have to always supply a rootUrl and http argument. Our http parameter does some extra checks, and assigns credentials. It would be nice to have this generated.
For the rootUrl, the generator generates this:
this.baseUrl = this.getBaseUrl("", baseUrl);
So it seems that the solution is to a base class which supplies the
getBaseUrl
function. This is fine with us, as we need a base class to supply the date reviver anyway.However, there doesn't seem to be a way to have a default argument for the
http
parameter, it is always generated as:this.http = http ? http : window as any;
I really don't want to assign something to window.fetch, in case it breaks a 3rd party. It would be nice if that argument worked like it does for the baseUrl.I suppose I could override the Fetch template.... What have others does in this scenario?
Beta Was this translation helpful? Give feedback.
All reactions